-
Title Description:
-
Compile a program, read the user input, and "." The end of a line of text, counting the total number of words, and separately output each word contains how many characters.
(the part that is separated by one or more spaces is a single word)
-
Input:
-
The input includes 1 lines of string to "." Ends with multiple words in the string, separated by one or more spaces between the words.
-
Output:
-
There may be multiple sets of test data, for each set of data,
The number of letters that each word in the output string contains.
-
Sample input:
-
Hello how is you.
-
Sample output:
-
5 3 3 3
1 ImportJava.util.Scanner;2 3 Public classmain{4 Public Static voidMain (String[]args) {5Scanner in=NewScanner (system.in);6 while(In.hasnext ()) {7String line=in.nextline ();8 Char[]x=Line.tochararray ();9 intCout=0;Ten for(inti=0;i<x.length;i++){ One if(x[i]!= ' &&x[i]!= '.){ Acout++; - } - Else if(x[i]== "&&x[i+1]=="){ the } - Else if(x[i]== '. ')){ - System.out.println (cout); - Break; + } - Else if(x[i]== "&&x[i+1]!="){ +System.out.print (cout+ ""); ACout=0; at } - } - } - } - } - in /************************************************************** - problem:1182 to user:0000h + Language:java - result:accepted the time:320 Ms * memory:29140 KB $ ****************************************************************/
Topic 1182: Statistical words