1182 Statistical words

Source: Internet
Author: User
/* Title Description: Compile a program, read the user input, to "." The end of a line of text, counting the total number of words, and separately output each word contains how many characters. (any part separated by one or more spaces is a single word) input: The input includes 1 lines of string, with "." Ends with multiple words in the string, separated by one or more spaces between the words. Output: There may be more than one set of test data, and for each set of data, the number of letters contained in each word in the output string. Sample input: Hello how is you. Sample output: 5 3 3 3*/# include <stdio.h># include <string.h>int main (void) {int i,j,k = 0,n,len , Count,a[20];char s[100];scanf ("%d", &n); for (i = 0; i < n; i++) {GetChar ();    Absorbs the carriage return character. if (n <= 0) break;gets (s); len = strlen (s); for (j = 0,count = 0; J < Len; J + +) {if ((s[j]! = ') && (s[j]! = '. ' ) {count++;continue;} A[k] = count;k++;if (s[j] = = '. ') Break;count = 0;} for (i = 0; i < K; i++) {if (a[i]! = 0) printf ("%d", A[i]);} printf ("\ n");} return 0;}

1182 Statistical words

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.