fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3. int main(){
  4. int T;
  5. cin>>T;
  6. cin.ignore();
  7. for(int count=0,first=1;T>=0;T--,count++,first=0){
  8. string m;
  9. getline(cin,m);
  10. // int t=' ';
  11. // cout<<t;
  12. if (first==0)
  13. cout<<"Case #"<<count<<":"<<"\n";
  14. for (;m.length()!=0;){
  15. int location=0,pass=1,ch=0;
  16. for (int i=0,first=1;i<m.length();i++){
  17. // cout<<m[i]<<"\n";
  18. if ((first==1 || pass==1) && ((m[i]>=65 && m[i]<=90) || (m[i]>=97 && m[i]<=123)) ){
  19. for (int j=i;j<=i+location;j++){
  20. if ((m[j]>=65 && m[j]<=90) || (m[j]>=97 && m[j]<=123))
  21. continue;
  22. else{
  23. ch=1;
  24. break;
  25. }
  26. }
  27. if (ch==0){
  28. // cout<<m[i]<<"\n";
  29. cout<<m[i+location];
  30. location++,pass=0,first=0;
  31. }
  32. }
  33. else if (m[i]==32){
  34. // cout<<i<<"\n";
  35. pass=1;
  36. ch=0;
  37. }
  38. }
  39. cout<<"\n";
  40. // cout<<"yes";
  41. getline(cin,m);
  42. // cout<<m[i]<<"\n";
  43. }
  44. cout<<"\n";
  45. }
  46. }
Success #stdin #stdout 0s 4192KB
stdin
4

note the space after the last word of the next line

second line 

The first line of input gives the number of cases T  one
less than or equals to  T less than or equals to thirty
    then there is a blank line before the first test

case Each test case represents a message  which is composed
 by one less than or equals to  N  less than or equals to
 hundred  lines and each line is composed by one to thirty 
 words
stdout
Case #1:
nhae

Case #2:
si

Case #3:
Tinusr
lhusly
thaer

Case #4:
caseege
bnsnls
hidhoy
w