import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner in = new Scanner(System.in); String name = in.next(); int size = name.length(); String word = ""; for (int i = 0; i < name.length(); i++) { char rev = name.charAt(size-i-1); // Index is Zero..... size = 4, i=0, -1 == 3; word = word + rev; } System.out.println(word); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter