fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner in = new Scanner(System.in);
  13.  
  14. String s1 = in.nextLine();
  15. String s2 = new String();
  16.  
  17. if(s1.length()<4){
  18. System.out.println("Невозможно выполнить операцию.");
  19. } else {
  20. s2=s1.substring(0, s1.length()-1);
  21. s2+=s1.charAt(0);
  22. s2+=s1.charAt(1);
  23. s2+=s1.charAt(s1.length()-1);
  24. }
  25. System.out.println(s2);
  26. }
  27. }
Success #stdin #stdout 0.14s 321280KB
stdin
qwerty
stdout
qwertqwy