Advertisement
Ilya_konstantinov

2crB

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