Didart

Reverse String 1

Sep 29th, 2021
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1. package src;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class ReverseString {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.        
  9.         String input = scanner.nextLine();
  10.         String reverse = "";
  11.  
  12.         for(int i = input.length() - 1; i >= 0; i --){
  13.             reverse += input.charAt(i);
  14.         }
  15.         System.out.println(reverse);
  16.     }
  17. }
  18.        
  19.  
Advertisement
Add Comment
Please, Sign In to add comment