@@ -0,0 +1,768 @@
+/*%0AWrite a function that takes a string as input and returns the string reversed.%0A%0AExample:%0AGiven s = %22hello%22, return %22olleh%22. %0A*/%0Aimport java.util.*;%0Aimport java.io.*;%0A%0Apublic class ReverseString %7B%0A%09public static String reverseString(String s) %7B%0A        char%5B%5D c = s.toCharArray();%0A        for (int i=0,j=c.length-1;i%3Cj;i++,j--)%7B%0A            char temp = c%5Bi%5D;%0A            c%5Bi%5D=c%5Bj%5D;%0A            c%5Bj%5D=temp;%0A        %7D%0A        return new String(c);%0A    %7D%09%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09Scanner reader = new Scanner(System.in);%0A%09%09System.out.println(%22Enter a string: %22);%0A%09%09String input = reader.nextLine();%0A%09%09String res = reverseString(input);%0A%09%09System.out.println(%22Source string: %22 + input);%0A%09%09System.out.println(%22Reverse string: %22 + res);%0A%09%09return;%0A%09%7D%09%0A%7D%0A

reverse string