Length of Last word
Basic Accuracy: 17.86% Submissions: 3575 Points: 1

Given a string S consisting of upper/lower-case alphabets and empty space characters ‘ ‘. The string may contain spaces at the end. You will have return the length of last word which consists of alphabets only.

Input:
First line of input consists of T test cases. The only line of every test case consists of String S.

Output:
You have to return the length of last word of the string.

Constraints:
1<=T<=100
1<=|String length|<=100

Example:
Input:

2
Geeks for Geeks
Start Coding Here
Output:
5
4

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.