{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e当Hosssam决定趁Hemose睡觉时潜入他的房间并更改他的笔记本密码。他已经知道密码,这是一个长度为$$$n$$$的字符串。他还知道字母表中有$$$k$$$个\u003cspan class\u003d\"tex-font-style-it\"\u003e特殊\u003c/span\u003e字母: $$$c_1,c_2,\\ldots, c_k$$$。\u003c/p\u003e\u003cp\u003eHosssam编写了一个可以执行以下操作的程序。\u003c/p\u003e\u003col\u003e \u003cli\u003e 该程序考虑当前密码$$$s$$$的长度$$$m$$$。\u003c/li\u003e\u003cli\u003e 然后它找到所有位置$$$i$$$ ($$$1\\le i\u0026lt;m$$$),使得$$$s_{i+1}$$$是$$$k$$$个特殊字母中的一个。\u003c/li\u003e\u003cli\u003e 然后它从密码$$$s$$$中删除所有这些位置的字符\u003cspan class\u003d\"tex-font-style-bf\"\u003e即使$$$s_{i}$$$是一个特殊字符\u003c/span\u003e。如果没有要删除的位置,则程序显示一个非常响亮的错误消息。\u003c/li\u003e\u003c/ol\u003e\u003cp\u003e例如,假设字符串$$$s$$$是\"\u003cspan class\u003d\"tex-font-style-tt\"\u003eabcdef\u003c/span\u003e\",特殊字符是\u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e\u0027和\u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003ed\u003c/span\u003e\u0027。如果他运行程序一次,位置$$$1$$$和$$$3$$$将被删除,因为它们出现在特殊字符之前,所以密码变为\"\u003cspan class\u003d\"tex-font-style-tt\"\u003ebdef\u003c/span\u003e\"。如果他再次运行程序,它将删除位置$$$1$$$,密码变为\"\u003cspan class\u003d\"tex-font-style-tt\"\u003edef\u003c/span\u003e\"。如果他聪明的话,他不会第三次运行它。\u003c/p\u003e\u003cp\u003eHosssam想知道他可以在Hemose的笔记本上运行程序多少次,而不会因为错误消息的声音而将他吵醒。你能帮帮他吗?\u003c/p\u003e"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e第一行包含一个整数$$$t$$$ ($$$1 \\le t \\le 10^5$$$) —— 测试用例的数量。接下来是$$$t$$$个测试用例。\u003c/p\u003e\u003cp\u003e每个测试用例的第一行包含一个整数$$$n$$$ ($$$2 \\le n \\le 10^5$$$) —— 密码的初始长度。\u003c/p\u003e\u003cp\u003e接下来一行包含一个由$$$n$$$个小写英文字母组成的字符串$$$s$$$ —— 初始密码。\u003c/p\u003e\u003cp\u003e下一行包含一个整数$$$k$$$ ($$$1 \\le k \\le 26$$$),后面跟着$$$k$$$个不同的小写字母$$$c_1,c_2,\\ldots,c_k$$$ —— 特殊字母。\u003c/p\u003e\u003cp\u003e保证所有测试用例中$$$n$$$的总和不超过$$$2\\cdot 10^5$$$。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e对于每个测试用例,打印Hosssam可以在不显示错误消息的情况下运行程序的最大次数,每个结果占一行。\u003c/p\u003e"}},{"title":"示例 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e10\n9\niloveslim\n1 s\n7\njoobeel\n2 o e\n7\nbasiozi\n2 s i\n6\nkhater\n1 r\n7\nabobeih\n6 a b e h i o\n5\nzondl\n5 a b c e f\n6\nshoman\n2 a h\n7\nshetwey\n2 h y\n5\nsamez\n1 m\n6\nmouraz\n1 m\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e5\n2\n3\n5\n1\n0\n3\n5\n2\n0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"注意","value":{"format":"HTML","content":"\u003cp\u003e在第一个测试用例中,程序可以运行$$$5$$$次,如下所示: $$$\\text{iloveslim} \\to \\text{ilovslim} \\to \\text{iloslim} \\to \\text{ilslim} \\to \\text{islim} \\to \\text{slim}$$$\u003c/p\u003e\u003cp\u003e在第二个测试用例中,程序可以运行$$$2$$$次,如下所示: $$$\\text{joobeel} \\to \\text{oel} \\to \\text{el}$$$\u003c/p\u003e\u003cp\u003e在第三个测试用例中,程序可以运行$$$3$$$次,如下所示: $$$\\text{basiozi} \\to \\text{bioi} \\to \\text{ii} \\to \\text{i}$$$。\u003c/p\u003e\u003cp\u003e在第四个测试用例中,程序可以运行$$$5$$$次,如下所示: $$$\\text{khater} \\to \\text{khatr} \\to \\text{khar} \\to \\text{khr} \\to \\text{kr} \\to \\text{r}$$$\u003c/p\u003e\u003cp\u003e在第五个测试用例中,程序只能运行一次,如下所示: $$$\\text{abobeih} \\to \\text{h}$$$\u003c/p\u003e\u003cp\u003e在第六个测试用例中,程序无法运行,因为密码中没有任何特殊字符。\u003c/p\u003e"}}]}