#P17330. [ICPC 2018 Nanjing R] Mediocre String Problem
[ICPC 2018 Nanjing R] Mediocre String Problem
Problem Description
Given two strings and , count the number of tuples such that
- .
- .
- The -th character of to the -th character of , concatenated with the first character of to the -th character of , is a palindrome.
A palindrome is a string which reads the same backward as forward, such as "" or "".
Input Format
The first line is the string ().
The second line is the string ().
Both and contain only lower case Latin letters.
Output Format
The number of such tuples.
ababa
aba
5
aabbaa
aabb
7