@@ -0,0 +1,354 @@
+public class CountPairs %7B%0A  public static void main (String... args) %7B%0A    // Result:3.%0A    System.out.println(new CountPairs ().countPairs (%22axaxa%22));%0A  %7D%0A  %0A  public int countPairs (String str) %7B%0A    return str.length()%3C3?0:str.substring(0,3).charAt(0)==str.substring(0,3).charAt(2)?1+countPairs (str.substring(1)):countPairs (str.substring(1));%0A  %7D%0A%7D%0A

Create CountPairs.java