Guess with "2 inputs"

So as i was declaring the function “guess”, I came across the issue that whenever I input mutiple words(example will follow), it returns mutiple "Invalid word. Try again: " statements.

"Please input your guess: "

My input: “te st”


"Invalid input. Try again: Invalid Input. Try again: "

So as you already guessed, it looks at these input as 2 seperate inputs.

However, I defined my function such that for any input, no matter how much space there is and how long the word is or how short, as long as it isnt correct, it returns invalid word ONCE (and it works perfectly fine).

So why could this be happening?
How should I look at this problem?
In case of such input, what should i do?

Also just a mini different question.
When incrementing rounds, does each invalid guess count as one or how does it work?

Thanks in advance.

I moved the question to a new topic to be easier accessible to other students and to allow for separate discussions.

It seems that you read te (until the space), are finished, output the message regarding an invalid input, and continue in the guess loop by prompting the user.
Then, you read the second “word” st and repeat the behavior.

Check and test the behavior of the read method you chose.

The exercise is very student friendly and specifies:

The behavior in the case of non-character inputs or too short
inputs is undefined

Therefore, you are free to do whatever you want.
One behavior would be to read everything te st and take this as a word of length five.
A more user friendly behavior would be to ignore whitespaces.
For instance, someone playing wordle might accidentally place a space after the word without noticing. Then, it would be very user friendly to simply ignore/delete the additional space.