fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Main
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. Scanner in = new Scanner(System.in);
  10. String str = in.nextLine();
  11. char[] s = str.toCharArray();
  12. int i = in.nextInt();
  13. int j = in.nextInt();
  14. for(int b = i - 1, c = j - 1; b < c; b++, c--) {
  15. char k = s[b];
  16. s[b] = s[c];
  17. s[c] = k;
  18. }
  19. System.out.println(s);
  20. }
  21. }
Success #stdin #stdout 0.07s 2184192KB
stdin
zbbg
2 3
stdout
zbbg