@@ -0,0 +1,1004 @@
+package codingbat.string2;%0A%0A/*%0A * Return true if the given string contains an appearance of %22xyz%22 %0A * where the xyz is not directly preceeded by a period (.). %0A * So %22xxyz%22 counts but %22x.xyz%22 does not. %0A * %0A * xyzThere(%22abcxyz%22) = true%0A * xyzThere(%22abc.xyz%22) = false%0A * xyzThere(%22xyz.abc%22) = true%0A * %0A */%0A%0Apublic class XyzThereTest %7B%0A%0A  public static void main(String%5B%5D args) %7B%0A%0A    XyzThereTest test = new XyzThereTest();%0A%0A    System.out.println(%22%3E%22 + test.xyzThere(%22abcxyz%22) + %22%3C%22);%0A    System.out.println(%22%3E%22 + test.xyzThere(%22abc.xyz%22) + %22%3C%22);%0A    System.out.println(%22%3E%22 + test.xyzThere(%22xyz.abc%22) + %22%3C%22);%0A  %7D%0A%0A  public boolean xyzThere(String str) %7B%0A    String word;%0A%0A    if (str.length() %3C 3) %7B%0A      return false;%0A    %7D%0A%0A    for (int i = 0; i %3C= str.length() - 3; i++) %7B%0A      word = str.substring(i, i + 3);%0A%0A      if (word.matches(%22xyz%22)) %7B%0A        if (i %3E 0 && str.substring(i - 1, i).equals(%22.%22)) %7B%0A          return false;%0A        %7D%0A        return true;%0A      %7D%0A    %7D%0A%0A    return false;%0A  %7D%0A%0A%7D%0A

starting task xyzThere