Advertisement
Ilya_konstantinov

Untitled

Dec 20th, 2024
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | Source Code | 0 0
  1. #include <iostream>
  2.  
  3. using std::cin;
  4. using std::cout;
  5. #include "func.h"
  6.  
  7. int main() {
  8.   cin.tie(nullptr); // some magic
  9.   std::ios::sync_with_stdio(false);
  10.   size_t n, q, k; cin >> n;
  11.   MyString str;
  12.   read(str,n);
  13.   cin >> q;
  14.   char cmd;
  15.   while(q--) {
  16.     cin >> cmd;
  17.     if (cmd == '?') print_size(str);
  18.     else {
  19.       cin >> k;
  20.       if (k--) erase(str, k);
  21.       else cout << pop_back(str) << '\n';
  22.     }
  23.   }
  24.   print(str);
  25.   del(str);
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement