BlueBook - First Blank

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 16M

Problem type
BlueBook

Find the first occurrence of a space (ASCII value 32) in a string.

Input Specification

The first line of input contains an integer T (1 \le T \le 100), indicating how many lines of input are to follow. Each of the following T lines contains one string S, whose length is at least 1 but less than 100. Note that the string consists of the entire line; trailing spaces are part of the string.

Output Specification

For each string given in input, print the position at which the first blank was found in that string, on one line. The first character in a string has position 1, the second 2, and so on. If no blank was found in the string, print 0 instead.

Sample Input

2
 2
22

Sample Output

1
0

Comments

There are no comments at the moment.