AtCoder Grand Contest 026
C
String Coloring
AtCoder
⌀ 1836
原题
← BD →
翻译中…

Problem Statement

翻译中…

You are given a string $S$ of length $2N$ consisting of lowercase English letters.

翻译中…

There are $2^{2N}$ ways to color each character in $S$ red or blue. Among these ways, how many satisfy the following condition?

翻译中…
  • The string obtained by reading the characters painted red from left to right is equal to the string obtained by reading the characters painted blue from right to left.
翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 18$
  • The length of $S$ is $2N$.
  • $S$ consists of lowercase English letters.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
S

翻译中…

Output

翻译中…

Print the number of ways to paint the string that satisfy the condition.

翻译中…

样例

Input #1
4
cabaacba
Output #1
4
There are four ways to paint the string, as follows: - cabaacba - cabaacba - cabaacba - cabaacba
Input #2
11
mippiisssisssiipsspiim
Output #2
504
Input #3
4
abcdefgh
Output #3
0
Input #4
18
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Output #4
9075135300
The answer may not be representable as a $32$-bit integer.
题目信息
题号
agc026_c
时间限制
3 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。