Leaderboard
Showing:
Program for length of the longest word in a sentence
Basic Accuracy: 46.07% Submissions: 3411 Points: 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

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.

Program for length of the longest word in a sentence

Output Window