How to check if multiple tables start with the same value?

I have this function which is being ran every frame by RenderStepped and I realized that it doesn’t do anything for when there’s sequences that start with the same input and I’m not quite show how to fix that.

local function CheckSequence()
	local commandInputIndex = 0 --stores the index of the InputSequence table
	local lastMatchIndex = 0 --stores the last matching move
	local matchedInputCount = 0 --stores the amount of matching inputs

	for moveIndex = 1, #Moveset do
		commandInputIndex = ((#InputSequence - 1) + 1) --makes sure that it always stays at 1
		matchedInputCount = 0 --sets it to zero for each move in the moveset
		--walk backwards through the sequence
		for inputIndex = #Moveset[moveIndex].Sequence, 1, -1 do
			--"consume" the InputSequence until it is no more or we found our target input.
			while (commandInputIndex >= 0) do
				if Moveset[moveIndex].Sequence[inputIndex] == InputSequence[commandInputIndex] then
					matchedInputCount += 1
					break
				end
				commandInputIndex -= 1 --decrease the InputSequence's index
			end
		end

		if (matchedInputCount == #Moveset[moveIndex].Sequence) then
			lastMatchIndex = moveIndex
			local move = Moveset[lastMatchIndex] 

			--if CheckIfMoveIsValid(move) then 
			print("you performed: "..move.Name)
			Modules.ClientCombat:MoveInputted(move)
			InputSequence = {} --reset InputSequence table
			break
			--end
		end
	end
end

I have a dictionary of moves which has a table for its sequence (the buttons used to input the move) like this

	[3] = {
		Sequence 	 = {"G","B"};
	},
	[4] = {
		Sequence 	 = {"G"};
	};

However both these moves start with the same input so when you input G it’s only gonna see that the bottom sequence matches so it’s gonna use that not letting the player ever input G,B. I temporaily just threw in a wait(0.01) at the top of a function which gives the player a tiny bit of a room to input both inputs however I don’t think using a wait is the best solution.