Length of Last word
Submissions: 2897   Accuracy:

16.76%

  Difficulty: Basic   Marks: 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

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Raj Seth
Author: saksham seth


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.