2937 - Palindrome Counting

Created by Yonny Mondelo Hernández
Added by ymondelo20 (2014-06-09)
Limits
Total Time: 120000 MS | Test Time: 6000 MS |Memory: 256 MB | Output: 64 MB | Size: 16 KB
Enabled languages
Available in

Description

Given a string S composed by lowercase letters of the Latin alphabet, you must find the number of distinct substrings in S, which are palindrome strings of at least 2 <= K <= |S| letters and are, at the same time, composed by two palindrome strings. A palindrome string is one string that is read in the same way, from left to right and from right to left.
;jsessionid=51828742E7682F8825AB5C93FE939250
Given a string S composed by lowercase letters of the Latin alphabet, you must find the number of distinct substrings in S, which are palindrome strings of at least 2 <= K <= |S| letters and are, at the same time, composed by two palindrome strings. A palindrome string is one string that is read in the same way, from left to right and from right to left.
;jsessionid=51828742E7682F8825AB5C93FE939250
Given a string S composed by lowercase letters of the Latin alphabet, you must find the number of distinct substrings in S, which are palindrome strings of at least 2 <= K <= |S| letters and are, at the same time, composed by two palindrome strings. A palindrome string is one string that is read in the same way, from left to right and from right to left.
;jsessionid=51828742E7682F8825AB5C93FE939250

Input specification

The first line of input contains an integer number, the value K. The second line, the string S (2 <= K <= |S| <= 10^4).
The first line of input contains an integer number, the value K. The second line, the string S (2 <= K <= |S| <= 10^4).
The first line of input contains an integer number, the value K. The second line, the string S (2 <= K <= |S| <= 10^4).

Output specification

The only line of output contains the number of distinct substrings in S which meet the above conditions.;jsessionid=51828742E7682F8825AB5C93FE939250
The only line of output contains the number of distinct substrings in S which meet the above conditions.;jsessionid=51828742E7682F8825AB5C93FE939250
The first line of input contains an integer number, the value K. The second line, the string S (2 <= K <= |S| <= 10^4).

Sample input

3
abaabaaba

Sample output

2

Hint(s)