Advertisement
Guest User

Untitled

a guest
Oct 7th, 2019
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Compare2{
  6. public static void main(String[]args){
  7. Scanner sc=new Scanner(System.in);
  8.  
  9. String line=sc.nextLine();
  10. String toPrint="";
  11.  
  12. while(!line.equals("end")){
  13. toPrint="";
  14. for(int i=line.length()-1;i>=0;i--){
  15. toPrint +=line.charAt(i);
  16.  
  17. if(toPrint.length()==line.length()){
  18. System.out.printf("%s = %s%n",line,toPrint);
  19. break;
  20. }
  21. }
  22. line=sc.nextLine();
  23. }
  24.  
  25.  
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement