问题 I: Make It Square

内存限制:512 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:Special Judge 上传者:
提交:3 通过:2

题目描述

链接:https://ac.nowcoder.com/acm/contest/57362/I
来源:牛客网
Luluu is a “Square” magician from Eorzea. “Square” magicians are experts to use “Square” spells.

Every spell can be represented as a non-empty string containing only lower-case English characters. The “Square” spells are those of even length which the first half is identical to the second half. For example, abcabc and aaaa are “Square” spells, while aaa and abcabd are not.

Today, Luluu found a powerful “Square” spell from Grimoire, but unfortunately, the book page is damaged, so some parts of the spell are not readable anymore.

More specifically, the original “Square” spell is of the format p+s+q+tp + s + q + tp+s+q+t, where sss and ttt are two constant strings, but ppp and qqq are the two unreadable parts of the spell. From some investigation, Luluu believes ppp and qqq should be of the same length that doesn't exceeds mmm.

Now, Luluu asks your help to calculate the number of all possible original “Square” spells. Could you help this poor magician?

输入格式

The first line contains a single integer mmm (1≤m≤1061 \le m \le 10^61m106), the second line contains a string sss and the third line contains a string ttt.
It is guaranteed that the length of sss and ttt don't exceed 10610^6106.

输出格式

Output mmm integers in a single line, the kkk-th of which indicates the number of possible original “Square” spells when the length of ppp and the length of qqq are both kkk.
The answers could be large, so you should output them modulo 998244353998\,244\,353998244353.
样例输入1:
3
b
acbac
样例输出1:
0 1 26
样例输入2:
6
abbabbababbab
bab
样例输出2:
0 0 1 0 1 26

输入样例 复制

3
abbab
b

输出样例 复制

0 1 26

数据范围与提示

For the first sample case:
When the length of ppp and qqq are both 111, there is no valid solution to make p+s+q+tp + s + q + tp+s+q+t a “Square” spell.
When the length of ppp and qqq are both 222, there is only one valid solution, which is (p=p =p=ab, q=q =q=ab). The “Square” spell is ababababbababababb.
When the length of ppp and qqq are both 333, there are 262626 valid solutions, which are of format (p=p =p= ab?, q=q =q=?ab), where ? could be any single lower-case English character.