Advertisement
PROFESSOR_AIH

Untitled

Apr 10th, 2023
513
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5.    char s[255];
  6.    gets(s);
  7.    int countword=0,countchar=0;
  8.    int arr[100];
  9.    for(int i=0;s[i]!='\0';i++)
  10.    {
  11.        if((s[i]>='A' && s[i]<='Z') || (s[i]>='a' && s[i]<='z'))
  12.        {
  13.            countchar++;
  14.        }
  15.        else
  16.        {
  17.            if(countchar!=0)
  18.            {
  19.            arr[countword]=countchar;
  20.            countchar=0;
  21.            countword++;
  22.            }
  23.            else
  24.             continue;
  25.        }
  26.    }
  27.    printf("%d\n",countword);
  28.    for(int i=0;i<countword;i++)
  29.    {
  30.        printf("%d ",arr[i]);
  31.    }
  32.    printf("\n");
  33.  
  34.  
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement