Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. #pragma comment(linker, "/STACK:128777216")
  2. #include <bits/stdc++.h>
  3. #define _USE_MATH_DEFINES
  4. using namespace std;
  5. typedef unsigned long long ull;
  6. typedef double dbl;
  7. typedef long double ldbl;
  8. typedef long long ll;
  9. typedef pair<ll,ll> pll;
  10. typedef string str;
  11. typedef vector<int> vi;
  12. typedef vector<ll> vll;
  13. typedef vector<bool> vbl;
  14. #define gepard ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  15. #define perfect cout << setprecision(5) << fixed;
  16.  
  17. char a;
  18. stack<char> q;
  19.  
  20. int main () {
  21.     gepard
  22.     while (cin.get(a)){
  23.             if(isalpha(a)){
  24.                 q.push(a);
  25.             }
  26.             else{
  27.                 if (!q.empty()){
  28.                     int size=q.size();
  29.                     for (int i=0; i<size; ++i){
  30.                         cout << q.top();
  31.                         q.pop();
  32.                     }
  33.                 }
  34.                 cout << a;
  35.             }
  36.     }
  37.  
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement