RGAlex

O1. Reverse String / Text Processing - Lab

Mar 11th, 2021
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1. package TextPlocessing.Lab;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class O1ReverseString {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         String input = scanner.nextLine();
  9.         while (!input.equals("end")) {
  10.             String result = new StringBuilder(input).reverse().toString();
  11.             System.out.println(input + " = " + result);
  12.             input = scanner.nextLine();
  13.         }
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment