fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. string s;
  6. cin >> s;
  7. int i, j;
  8. cin >> i >> j;
  9. for (int b = i - 1, c = j - 1; b < c; b++,c--) {
  10. int k = s[b];
  11. s[b] = s[c];
  12. s[c] = k;
  13.  
  14. }
  15. cout << s;
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 4224KB
stdin
zbbg 
2 3 
stdout
zbbg