logo AlgoBeat OnlineJudge
登录 注册

#217542. [ICPC 2018 Nanjing R] Mediocre String Problem

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Given two strings and , count the number of tuples such that

  1. .
  2. .
  3. 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 "".

输入格式

The first line is the string ().

The second line is the string ().

Both and contain only lower case Latin letters.

输出格式

The number of such tuples.

样例

样例输入 1

ababa
aba

样例输出 1

5

样例输入 2

aabbaa
aabb

样例输出 2

7