String exercises, C language string exercises
Your program needs to read a line of text, separated by spaces as several words, ended. You need to output the length of each word in this line of text. The words here are irrelevant to the language and can contain various symbols. For example, "it's" is a word with a length of 4. Note that consecutive spaces may appear in the row.
Input Format:
Enter a line of text in a row and end with '.'. The ending period cannot be within the length of the last word.
Output Format:
Output the length of the word corresponding to this line of text in one line. Each length is separated by a space. There is no final space at the end of the line.
Input example:
It's great to see you here.
Output example:
4 5 2 3 3 4
# Include <stdio. h> # define M 1000int main () {int count, I; int flag = 1; char word [M]; gets (word); count = I = 0; while (1) {if (count & (word [I] = ''| word [I] = '. ') // The last word may be a space or '. '{if (flag = 1) // tag, output for the first time
{Printf ("% d", count); flag ++;} else printf ("% d", count); count = 0 ;} while (word [I] = '') // multiple spaces may exist {I ++;} if (word [I] = '. ') {printf ("\ n"); break;} count ++; I ++;} return 0 ;}
// Test example:
// It's great to see you here.
// 4 5 2 3 3 4
// It's g ~ Reat t ** (o s ^ % 7e + you here. // The interval Table key for great
// 4 7 5 6 3 4