I had questions about user input in the function
Is the user allowed to enter strings with spaces and/or new line characters? Because when I use scanf to read the user input, it only reads up to space, meaning that the second part of the string (after space) is read in second iteration, giving feedback twice.
How do we deal with inputs longer than k? If I allocate a buffer of a certain size to store user input, and if the input happens to be longer than the buffer size, it would cause buffer overflow and hence undefined behaviour. How do I deal with it?