package com.company;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter the String: ");
String str = input.nextLine();
String ans = "";
for(int i = str.length() -1 ;i>=0; i --){
ans = ans + str.charAt(i);
}
System.out.println(ans);
}
}
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (2)
Or just do it simpler with String builder
StringBuilder sb=new StringBuilder(string);
sb.reverse();
Thanks,
I am just starting out with programming