#Lutece1978. 我编不来故事了啦

我编不来故事了啦

Migrated from Lutece 1978 我编不来故事了啦

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

给出两个仅包含小写字符的字符串 A 和 B ,求:对于 A 中的每个回文子串,B 中和该子串相同的子串个数的总和。

如 ababa 和 babab 有 16 个,见 hint 。

Input

只有一组测试数据,两行字符串。

A 和 B 的长度均小于200000200000

Output

输出 AB 串中相同的回文子串个数的总和。

Samples

ababa
babab
16

Note

A 串中有回文字符串 a b a b a aba bab aba ababa ,

与之对应的 B 串中分别有 2 3 2 3 2 1 2 1 0 个子串和其相等,求和为 16 。

Resources

2018 UESTC ACM Training for Search Algorithm and String