title: Count how many palindromes in a string
body: <p>I want to find out all possible palindromes that can be possible using substrings from a given string.</p>
  
  <pre><code>Example: input = abbcbbd.
  Possible palindromes are a,b,b,c,b,b,d,bb,bcb, bbcbb,bb
  </code></pre>
  
  <p>Here is the logic I have implemented:</p>
  
  <pre><code>public int palindromeCount(String input) {
      int size = input.length();// all single characters in string are treated as palindromes.
      int count = size;
      for(int i=0; i&lt;size; i++) {
          for(int j=i+2; j&lt;=size; j++) {
              String value = input.substring(i, j);
              String reverse = new StringBuilder(value).reverse().toString();
              if(value.equals(reverse)) {
                  count++;
              }
          }
      }
      return count;
  }
  </code></pre>
  
  <p>Here the time complexity is more, how can I improve the performance of this logic?</p>