Reverse String
Single File Programming Question
Problem Statement
Jack is learning programming and wants to practice programs. The goal is to create a program that takes an input string and outputs the reversed version of that string.
Jack should utilize the following built-in Java packages: java.util.Scanner for reading input and java.lang.StringBuilder for efficiently reversing the string.
Help Jack by writing a program that fulfills these requirements.
Input:
format :The input consists of a string S.
Output:
format :The output prints the reversed string S.
Refer to the sample output for formatting specifications.
Code constraints : The given test cases fall under the following constraints:
The string S will contain only printable ASCII characters, including spaces.
Sample test cases :
Input 1:
hello world
Output 1 :
dlrow olleh
Input 2 :
Java Programming
Output 2 :
gnimmargorP avaJ