CF1409F Subsequences of Length Two
题目描述
你将会得到两个字符串 $s$ 和 $t$,并保证其中的字符都是小写拉丁字母。$t$ 的长度是 $2$。
一个操作代表你可以用一个任意的字符代替 $s$ 中任意一个字符(都是小写字母)。
你最多可以进行 $k$ 次操作,也可以不进行。
求进行替换之后最多可以在 $s$ 中出现多少个 $t$ 作为他的子序列。这里的子序列是指去掉原来字符串里的一些字符,不改变相对位置得到的串。
输入格式
第一行包括两个数 $n$,$k$ ($2\le n,k\le 200$)。
接下来的两行分别是 $s$,$t$。
输出格式
输出一行一个数,表示最多用 $k$ 次操作之后,出现子序列是 $t$ 的最多的次数。
说明/提示
In the first example, you can obtain the string "abab" replacing $ s_1 $ with 'a' and $ s_4 $ with 'b'. Then the answer is $ 3 $ .
In the second example, you can obtain the string "ssddsdd" and get the answer $ 10 $ .
In the fourth example, you can obtain the string "aaacaaa" and get the answer $ 15 $ .