language: C++ (gcc-4.3.4)
date: 107 days 1 hour ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <cctype>
#include <vector>
#include <string>
#include <iostream>
using namespace std ;
 
int main()
{
int t , len ;
int i ;
string str ;
string res ;
cin >> t ;
while( t-- ){
getline ( cin , str );
res = "" ;
len = str.size() ;
for ( i = 0 ; i < len ; i++ ){
if ( isalpha(str[i]) && ( i == 0 || str[i-1] == ' ' ) ){
res.append(1,str[i]);
}
}
res.append(1,'\0');
cout << res << endl ;
}
return 0;
}