advictoriam Jan 11th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- import java.util.Scanner;
- Reads a string, reverses the order the characters within the
- string, and prints out the result.
- Input: the value of s, a string
- Output: the string reversed
- public class ReverseString
- public static void main(String args)
- Scanner in = new Scanner(System.in);
- String s = in.nextLine();
- String reversed = "";
- for(int i = s.length() - 1; i > -1; i--)
- reversed += s.charAt(i);
RAW Paste Data