Advertisement
deyanmalinov

03. Reverse Strings

Mar 21st, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. package DPM;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.         public static void main(String[] args) {
  7.             Scanner scan = new Scanner(System.in);
  8.  
  9.             String line = "";
  10.             while (!"end".equals(line=scan.nextLine()){
  11.                 String newLine = "";
  12.  
  13.                 for (int i = line.length()-1; i >=0 ; i--) {
  14.                     newLine += line.charAt(i);
  15.                 }
  16.  
  17.                 System.out.printf("%s = %s\n",line, newLine);
  18.  
  19.             }
  20.  
  21.         }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement