rayated

52ps 20

Jan 4th, 2022 (edited)
884
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.08 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. int main()
  5. {
  6.     int t,i,j,length,count;
  7.     char s[10000],temp;
  8.    
  9.     scanf("%d",&t);
  10.    
  11.     for(i=0;i<t;i++)
  12.     {
  13.         scanf(" %[^\n]",s);
  14.         count=0;
  15.         temp=' ';
  16.         length=strlen(s);
  17.  
  18.         if( (s[j-1]>='A'&&s[j-1]<='Z') || (s[j-1]>='a'&&s[j-1]<='z')|| (int)s[j-1]==39 )
  19.             {
  20.                 temp='a';
  21.                 count++;
  22.             }
  23.  
  24.         for(j=1;j<length;j++)
  25.         {
  26.             if(temp==' ')
  27.             {
  28.                 if( (s[j-1]>='A'&&s[j-1]<='Z') || (s[j-1]>='a'&&s[j-1]<='z')|| (int)s[j-1]==39 )
  29.                 {
  30.                     temp='a';
  31.                     count++;
  32.                 }
  33.             }
  34.             else
  35.             {
  36.                 if( (s[j-1]>='A'&&s[j-1]<='Z') || (s[j-1]>='a'&&s[j-1]<='z')|| (int)s[j-1]==39 )
  37.                 {
  38.                     continue;
  39.                 }
  40.                 else
  41.                 {
  42.                     temp=' ';
  43.                 }
  44.             }
  45.         }
  46.        
  47.         printf("count = %d\n",count);
  48.     }
  49.    
  50.     return 0;
  51. }
Add Comment
Please, Sign In to add comment