#Lutece2421. Nico~Nico~Ni~ (Ⅱ)

Nico~Nico~Ni~ (Ⅱ)

Migrated from Lutece 2421 Nico~Nico~Ni~ (Ⅱ)

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

这次的 鬼畜视频 可以用一个仅包含小写英文字母的字符串 SS 来表示。

定义一个字符串 TTSS 中的容错为 22 匹配数为与 TT 长度相等且至多有 22 个对应位置的字符不同的 SS 的子串个数。

作为一名计数菌,你选择了一个字符串 TT,并想计算它在 SS 中的容错为 22 匹配数。

Input

第一行一个正整数 tt,表示有 tt 组测试数据。

每组测试数据两行,对于第 ii 组测试数据:

第一行包含一个仅由小写英文字母构成的字符串 SiS_i

第二行包含一个仅由小写英文字母构成的字符串 TiT_i

Output

输出 tt 行,第 ii 行一个整数 xix_i,表示第 ii 组测试数据的答案。

Samples

1
niconikoriko
nico
3

Constraints

1t1061 \leq t \leq 10^6

Si,Ti1  (1it)|S_i|, |T_i| \geq 1 \ \ (1 \leq i \leq t)

$\displaystyle \sum_{i=1}^t (|S_i| + |T_i|) \leq 2 \times 10^6$

Note

关于 NicoNicoNi~ (Ⅰ),它在 这里

Resources

2020 UESTC ICPC Training for String and Search Algorithm