SHARE
TWEET

Untitled

a guest Dec 9th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. #pragma GCC optimize("O3")
  3. #define PI 2*asin(1)
  4. #define int long long
  5. #define mod 1000000007
  6. #define all(a) begin(a),end(a)
  7. #define fore(i, j, n) for(long long i = j; i < n; i++)
  8. using namespace std;
  9.  
  10. void solve(){
  11.   int n; cin >> n;
  12.   vector<pair<int,string>>a(n);
  13.   fore(i,0,n){
  14.     string s; cin >> s;
  15.     reverse(all(s));
  16.     a[i] = {s.size(), s};
  17.   }
  18.   int last = 0;
  19.   fore(i,0,n){
  20.     if(last != a[i].first) {cout << a[i].first << '\n'; last = a[i].first;}
  21.     cout << a[i].second << '\n';
  22.   }
  23. }
  24.  
  25. int32_t main() {
  26.   //freopen("input.txt", "r", stdin);
  27.   //freopen("output.txt", "w", stdout);
  28.   solve();
  29.   return 0;
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top