Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- int t,i,j,length,count;
- char s[10000],temp;
- scanf("%d",&t);
- for(i=0;i<t;i++)
- {
- scanf(" %[^\n]",s);
- count=0;
- temp=' ';
- length=strlen(s);
- if( (s[j-1]>='A'&&s[j-1]<='Z') || (s[j-1]>='a'&&s[j-1]<='z')|| (int)s[j-1]==39 )
- {
- temp='a';
- count++;
- }
- for(j=1;j<length;j++)
- {
- if(temp==' ')
- {
- if( (s[j-1]>='A'&&s[j-1]<='Z') || (s[j-1]>='a'&&s[j-1]<='z')|| (int)s[j-1]==39 )
- {
- temp='a';
- count++;
- }
- }
- else
- {
- if( (s[j-1]>='A'&&s[j-1]<='Z') || (s[j-1]>='a'&&s[j-1]<='z')|| (int)s[j-1]==39 )
- {
- continue;
- }
- else
- {
- temp=' ';
- }
- }
- }
- printf("count = %d\n",count);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment