Count the characters in each word in a given sentence
Submissions: 1557   Accuracy:

37.85%

  Difficulty: Basic   Marks: 1

Given a string containing multiple words, your task is to count the characters in each word and display them.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each testcase contains a string as input.

Output:
For each testcase, print the number of characters in each word of the string.

Constraints:
1<=T<=100

Example:

Input:
2
the quick brown fox
geeks for geeks

Output:
3 5 5 3
5 3 5

Explanation:
For testcase 1:
the has 3 characters
quick has 5 characters
brown has 5 characters
fox has 3 characters

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

Contributor: Ankit Sharma
Author: Soul_xhacker


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.