First test case always giving '0'

Viewed 40

I am trying to output lengths of strings for a number of test cases. But output comes out as 0 for the first test case.

int test_case;
    cin >> test_case;    
while (test_case--)
        {
            string s;
            getline(cin, s);
            cout << s.size() << endl;
        }

so if I input

3(test_cast)

include

all

information

output becomes

0

7

3

whereas it should have 7 3 11

0 Answers
Related