INPUT STRINGS WITH WHITESPACES

See the test case i gave-

2\n
String 1\n
String 2\n

After reading integer 2, your pointer is here (denoted by *)-

2*\n
String 1\n
String 2\n

Char c will read the immediate next new-line char, and then str will read string 1.