#T2204. 必需子串(Required Substring)

必需子串(Required Substring)

链接: https://cses.fi/problemset/task/1112

板块: String Algorithms

时限: 1.00 s | 内存: 512 MB

题目描述

你的任务是计算长度为 nn、且以给定长度为 mm 的模式串作为子串的字符串个数。所有字符串均由 A–Z 组成。

输入

第一行输入包含一个整数 nn:最终字符串的长度。

第二行包含一个长度为 mm 的模式串。

输出

输出字符串个数,对 109+710^9+7 取模。

数据范围

1n10001 \le n \le 1000 1m1001 \le m \le 100

样例输入

6
ABCDB

样例输出

52