i was trying to solve MAYAand found strange thing .in my while loop getline does not ask for input in first iterationplease help..
scanf doesn't remove any whitespace after the input from the input stream.
1 \n 2\n 3\n
The stream after scanf("%d",&n) is:
\n 2\n 3\n
Just use getline once after the scanf.