Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- char str[1003];
- int main()
- {
- int test,i,j,k,len,x;
- string s;
- scanf("%d",&test);
- getchar();
- getchar();
- for(x=1; x<=test; x++)
- {
- i = 0;
- int cnt = 1,take = 1;
- bool found = true;
- printf("Case #%d:\n",x);
- while(gets(str) && str[0])
- {
- len = strlen(str);
- s="";
- for(k=0; k<len; k++)
- {
- if((str[k]>='a' && str[k]<='z')||(str[k]>='A' && str[k]<='Z'))
- {
- while(str[k]!=' ' && str[k]!='\0')
- {
- if(cnt==take && found)
- {
- s+=str[k];
- take++;
- cnt = 1;
- found = false;
- }
- cnt++;
- k++;
- }
- if(str[k]==' ')
- {
- cnt = 1;
- }
- }
- found = true;
- }
- printf("%s\n",s.c_str());
- cnt = 1;
- take = 1;
- }
- if(x<test)
- puts("");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment