Score : $500$ points
We have a typewriter with $N$ rows. The keys in the $i$-th row from the top can type the characters in a string $S_i$.
Let us use this keyboard to enter a string, as follows.
How many strings of length $L$ can be entered in this way? Since the answer can be enormous, print it modulo $998244353$.
abcdefghijklmnopqrstuvwxyz
.Input is given from Standard Input in the following format:
$N$ $L$ $S_1$ $S_2$ $\dots$ $S_N$
Print the answer.
2 2 ab ac
7
We can enter seven strings: aa
, ab
, ac
, ba
, bb
, ca
, cc
.
4 3 abcdefg hijklmnop qrstuv wxyz
1352
5 1000000000 abc acde cefg abcfh dghi
346462871
Be sure to print the answer modulo $998244353$.