package leetcode;

/**
 * https://leetcode.com/problems/palindromic-substrings/
 */
public class Problem647 {
    public int countSubstrings(String s) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem647 prob = new Problem647();
        System.out.println(prob.countSubstrings("abc")); // 3
        System.out.println(prob.countSubstrings("aaa")); // 6
    }
}

@@ -158,32 +158,721 @@
     
-// TODO%0A        return 0
+return countSubstrings(s, 0, s.length());%0A    %7D%0A%0A    private static int countSubstrings(String s, int i, int j) %7B%0A        if (i %3E= j) %7B%0A            return 0;%0A        %7D%0A        String sub = s.substring(i, j);%0A        int count = 0;%0A        if (isPalindrome(sub)) %7B%0A            count++;%0A        %7D%0A        int a = countSubstrings(s, i + 1, j);%0A        int b = countSubstrings(s, i, j - 1);%0A        int c = countSubstrings(s, i + 1, j - 1);%0A        return count + a + b + c;%0A    %7D%0A%0A    private static boolean isPalindrome(String s) %7B%0A        for (int i = 0, j = s.length() - 1; i %3C= j; i++, j--) %7B%0A            if (s.charAt(i) != s.charAt(j)) %7B%0A                return false;%0A            %7D%0A        %7D%0A        return true
 ;%0A  
@@ -1027,16 +1027,18 @@
 ); // 3%0A
+//
         

Update porblem 647