Program for length of the longest word in a sentence
Submissions: 2383   Accuracy:

43.66%

  Difficulty: Basic   Marks: 1

Given a string, we have to find the longest word in the input string and then calculate the number of characters in this word.

Input:
The first line of input contains an integer T,  number of test cases. For each test case, there is a string s. 

Output:
For each test case, the output is an integer denoting the length of the longest word in the sentence.

Constraints:
1<=T<=100

Example:
Input:

2
A computer science portal for geeks
I am an intern at geeksforgeeks
Output
8
13

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

Contributor: Vanshika
Author: Vanshika_pec


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.