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 ; } |
I2luY2x1ZGUgPGNjdHlwZT4KI2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkIDsKIAovKmludCBtYWluKCkKewppbnQgdCAsIGxlbiA7CmludCBpIDsKc3RyaW5nIHN0ciA7CnN0cmluZyByZXMgOwpjaW4gPj4gdCA7CndoaWxlKCB0LS0gKXsKZ2V0bGluZSAoIGNpbiAsIHN0ciApOwpyZXMgPSAiIiA7CmxlbiA9IHN0ci5zaXplKCkgOwpmb3IgKCBpID0gMCA7IGkgPCBsZW4gOyBpKysgKXsKaWYgKCBpc2FscGhhKHN0cltpXSkgJiYgKCBpID09IDAgfHwgc3RyW2ktMV0gPT0gJyAnICkgKXsKcmVzLmFwcGVuZCgxLHN0cltpXSk7Cn0KfQpyZXMuYXBwZW5kKDEsJ1wwJyk7CmNvdXQgPDwgcmVzIDw8IGVuZGwgOwp9CnJldHVybiAwOwp9Ki8KIAppbnQgbWFpbiAoKQp7CmludCB0ICwgbGVuIDsKaW50IGkgOwpzdHJpbmcgc3RyICwgcmVzIDsKY2luID4+IHQgOwp3aGlsZSAoIHQtLSApewpnZXRsaW5lICggY2luICwgc3RyICkgOwpsZW4gPSBzdHIubGVuZ3RoKCkgOwpmb3IgKCBpID0gMCA7IGkgPCBsZW4gOyBpKysgKXsKaWYgKCAoIGkgPT0gMCAmJiBpc2FscGhhKHN0cltpXSkgKSB8fCAoIGlzYWxwaGEoc3RyW2ldKSAmJiBzdHJbaS0xXSA9PSAnICcgKSApewpjb3V0IDw8IHN0cltpXSA7Cn0KfQpjb3V0IDw8IGVuZGwgOwp9CnJldHVybiAwIDsKfQ==
-
upload with new input
-
result: Success time: 0.01s memory: 2860 kB returned value: 0
2 asd Basd w e rwer Asd er wer AAA asdp
aBwer
-
result: Runtime error time: 0.21s memory: 2728 kB signal: 25 (SIGXFSZ)



