Basically I first takes an integer as input and then test case follows. My each test case is an string. I am suppose to print the string back if the starting patten of strin
Your cin >>N stops at the first non-numeric character, which is the newline. This you have a getline to read past it, that's good.
Each additional getline after that reads the entire line, including the newline at the end. By putting in a second getline you're skipping half your input.