@@ -0,0 +1,748 @@
+package codingbat.string2;%0A%0A/*%0A * Return the number of times that the string %22hi%22 appears anywhere %0A * in the given string. %0A * %0A * countHi(%22abc hi ho%22) = 1%0A * countHi(%22ABChi hi%22) = 2%0A * countHi(%22hihi%22) = 2%0A * %0A */%0A%0Apublic class countHiTest %7B%0A%0A  public static void main(String%5B%5D args) %7B%0A%0A    countHiTest test = new countHiTest();%0A%0A    System.out.println(%22%3E%22 + test.countHi(%22abc hi ho%22) + %22%3C%22);%0A    System.out.println(%22%3E%22 + test.countHi(%22ABChi hi%22) + %22%3C%22);%0A    System.out.println(%22%3E%22 + test.countHi(%22hihi%22) + %22%3C%22);%0A  %7D%0A%0A  public int countHi(String str) %7B%0A    int counter = 0;%0A    %0A    for (int i = 0; i %3C= str.length() - 2; i++) %7B%0A      if (str.substring(i, i + 2).equals(%22hi%22)) %7B%0A        counter += 1;%0A      %7D%0A    %7D%0A    %0A    return counter;%0A  %7D%0A%0A%7D%0A

add task countHi