Iamtui1010

chuso.cpp

Sep 17th, 2022 (edited)
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include<iostream>
  2. #include<algorithm>
  3.  
  4. #define long long long
  5. #define nln '\n'
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. freopen("chuso.inp", "r", stdin);
  12. freopen("chuso.out", "w", stdout);
  13. string str;
  14. getline(cin, str, nln);
  15. long n, m;
  16. cin >> n >> m;
  17. for (long i = 0; i < n; ++i){
  18. string tmp = str;
  19. reverse(tmp.begin(), tmp.end());
  20. str += tmp;
  21. }
  22.  
  23. if (m > str.size())
  24. cout << -1 << nln;
  25. else
  26. cout << str[m-1] << nln;
  27.  
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment