Panda and palindrome

4.1

14 votes
Problem

Panda is an artist and he is obsessed with palindromic number . He want to count the number of palidromic number can be generated by resuffling of any contiguous substring of given numberic string.Please Help panda by contributing your code.

Input :
First Line contain an Integer N (size of String). Second Line contain Given string.

Output:
Output a single integer according to question.

Note:- All Single Digit number are palindromic number.

Constraints
1<=N<=10^5

Sample Input
5
12121
Sample Output
11
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Generated palindromic number by reshuffling substring.
[1],[121],[1212],[12121],
[2],[212],[2121],
[1],[121],
[2],
[1] .

Editor Image

?