Category: Code

How will you count number of repeated characters from a String which is a palindrome and then calculate the product of those separate counts. For example, if the String is ababa, the output should be product of 3 a’s and 2 b’s which is 6

The program is implemented in Java. Algorithm: (1) First, check whether the String is a palindrome. (2) Set count =1 for the character you going to compare it with the whole string and then use a character, for example, I used '$' to keep counting (3) Multiply the counts separately into a variable.   package ...