@@ -0,0 +1,1164 @@
+package coding4fun;%0A%0A/**%0A * Reverse the order of the words in a string in-place.%0A * %3Cpre%3E%0A * Input: hi there programming is such a fun activity%0A * Output: activity fun a such is programming there hi%0A * %3C/pre%3E%0A */%0Apublic class Problem8 %7B%0A    private static void reverse(char%5B%5D string) %7B%0A        reverse(string, 0, string.length);%0A        int beginIdx = 0;%0A        for (int i = 0; i %3C string.length; i++) %7B%0A            if (string%5Bi%5D == ' ') %7B%0A                reverse(string, beginIdx, i);%0A                beginIdx = i + 1;%0A            %7D%0A        %7D%0A        reverse(string, beginIdx, string.length);%0A    %7D%0A    %0A    private static void reverse(char%5B%5D string, int beginIdx, int endIdx) %7B%0A        int mid = beginIdx + ((endIdx - beginIdx) / 2);%0A        for (int i = beginIdx, j = 0; i %3C mid; i++, j++) %7B%0A            char tmp = string%5Bi%5D;%0A            string%5Bi%5D = string%5BendIdx-1-j%5D;%0A            string%5BendIdx-1-j%5D = tmp;%0A        %7D%0A    %7D%0A    %0A    public static void main(String%5B%5D args) %7B%0A        String str = %22hi there programming is such a fun activity%22;%0A        char%5B%5D chrArray = str.toCharArray();%0A        reverse(chrArray);%0A        System.out.println(chrArray);%0A    %7D%0A%7D%0A

Add problem 8