fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5. int t;
  6. cin>>t;
  7. while(t--){
  8. string s;
  9. cin.ignore();
  10. getline(cin, s);
  11. string ans;
  12. ans+=s[0];
  13. for(int i = 1; i<s.length()-1; i++){
  14. if(s[i]==32){
  15. ans+=s[i+1];
  16. }
  17. }
  18. cout<<ans<<endl;
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5280KB
stdin
7
united states america
oh my god
i cant lie
binary indexed tree
believe in yourself
skibidi slay sigma
god bless america
stdout
usa
hmg
 l
iit
eiy
kss
oba