Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <algorithm>
  5.  
  6. using namespace std;
  7.  
  8. /**
  9.  * Auto-generated code below aims at helping you parse
  10.  * the standard input according to the problem statement.
  11.  **/
  12. int main()
  13. {
  14.     string S;
  15.     int j=0;
  16.     getline(cin, S);
  17.     string temp[40];
  18.     for (int i=0; i<S.length(); i++){
  19.         if (S[i]==' '){
  20.       j++;
  21.         continue;
  22.         }
  23.           temp[j]+=S[i];
  24.     }
  25.    
  26.    
  27.     for (int i=j; i>=0; i--){
  28.      cout<<temp[i];
  29.      if (i!=0) cout<<" ";
  30.     }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement