Advertisement
CR7CR7

str

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