Max and Palindromes Solution

      

Max and Palindromes  Solution

SOLUTION

” CLICK HERE “


Max has recently studied about palindromes and yesterday he came across a simple problem in which he was given a string S and he had to report the total number of unique palindromes of length 3 which can be formed by using the characters of the string.

Note – The string contains only lowercase characters.

Input:

  • A single string S.

Output:

Total number of unique palindromes of length 3.

Constraints

  • 1≤lengthofS≤105

Sample Input:

    aabc

Sample Output:

    2

EXPLANATION:

The 2 unique palindrome Max can form are aba and aca,


Reactions