Specific question about movement

Hello everyone,

I’m currently trying to make a very simple game where movement in one direction is done by pressing 2 keys alternately…

for example to move to the left, the user has to press A, S, A, S … repeatedly (kind of like twiddling his fingers

and to move to the right, the user would have to press K, L, K, L repeatedly…

can anyone give me some insight on how this could be done?

thanks in advance