language: C++ (gcc-4.3.4)
date: 102 days 20 hours 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#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;
}*/
 
int main ()
{
int t , len ;
int i ;
string str , res ;
cin >> t ;
while ( t-- ){
getline ( cin , str ) ;
len = str.length() ;
for ( i = 0 ; i < len ; i++ ){
if ( ( i == 0 && isalpha(str[i]) ) || ( isalpha(str[i]) && str[i-1] == ' ' ) ){
cout << str[i] ;
}
}
cout << endl ;
}
return 0 ;
}