Test cases don’t provide any examples with spaces.
When reading from stdin, most system functions read up until the first whitespace char.
(whitespace examples: space, \t \v \r \h \f)
In C, a working method to get the string completely in that puzzle would be:
char *str = (char*)malloc(sizeof(char) * 200);
fgetc(stdin);
fgets(str, 200, stdin);
HINT:
str ends up with a New Line char, which should be ignored.