import java.util.Scanner; import java.util.Stack; public class Reverse { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String S = scanner.nextLine(); Stack stack = new Stack<>(); StringBuilder reversed = new StringBuilder(); S.codePoints().forEach(cp -> stack.push(cp)); while (!stack.empty()) { reversed.appendCodePoint(stack.pop()); } System.out.println(reversed.toString()); scanner.close(); } }