{"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\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eYou are given two strings $$$a$$$ and $$$b$$$, both consisting of lowercase Latin letters. \u003c/p\u003e\u003cp\u003eA \u003cspan class\u003d\"tex-font-style-it\"\u003esubsequence\u003c/span\u003e of a string is a string which can be obtained by removing several (possibly zero) characters from the original string. A \u003cspan class\u003d\"tex-font-style-it\"\u003esubstring\u003c/span\u003e of a string is a contiguous subsequence of that string.\u003c/p\u003e\u003cp\u003eFor example, consider the string \u003cspan class\u003d\"tex-font-style-tt\"\u003eabac\u003c/span\u003e:\u003c/p\u003e\u003cul\u003e \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003ec\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eab\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eaa\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eac\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eba\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003ebc\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eaba\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eabc\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eaac\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003ebac\u003c/span\u003e and \u003cspan class\u003d\"tex-font-style-tt\"\u003eabac\u003c/span\u003e are its subsequences; \u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003ec\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eab\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eba\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eac\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003eaba\u003c/span\u003e, \u003cspan class\u003d\"tex-font-style-tt\"\u003ebac\u003c/span\u003e and \u003cspan class\u003d\"tex-font-style-tt\"\u003eabac\u003c/span\u003e are its substrings. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eYour task is to calculate the minimum possible length of the string that contains $$$a$$$ as a substring and $$$b$$$ as a subsequence.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains a single integer $$$t$$$ ($$$1 \\le t \\le 10^3$$$)\u0026nbsp;— the number of test cases.\u003c/p\u003e\u003cp\u003eThe first line of each test case contains a string $$$a$$$ ($$$1 \\le |a| \\le 100$$$), consisting of lowercase Latin letters.\u003c/p\u003e\u003cp\u003eThe second line of each test case contains a string $$$b$$$ ($$$1 \\le |b| \\le 100$$$), consisting of lowercase Latin letters.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case, print a single integer\u0026nbsp;— the minimum possible length of the string that contains $$$a$$$ as a substring and $$$b$$$ as a subsequence.\u003c/p\u003e"}},{"title":"Examples","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\u003e5\naba\ncb\ner\ncf\nmmm\nmmm\ncontest\ntest\ncde\nabcefg\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\n4\n3\n7\n7\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eIn the examples below, the characters that correspond to the subsequence equal to $$$b$$$ are bolded.\u003c/p\u003e\u003cp\u003eIn the first example, one of the possible answers is \u003cspan class\u003d\"tex-font-style-tt\"\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003ec\u003c/span\u003ea\u003cspan class\u003d\"tex-font-style-bf\"\u003eb\u003c/span\u003ea\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eIn the second example, one of the possible answers is \u003cspan class\u003d\"tex-font-style-tt\"\u003eer\u003cspan class\u003d\"tex-font-style-bf\"\u003ecf\u003c/span\u003e\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eIn the third example, one of the possible answers is \u003cspan class\u003d\"tex-font-style-tt\"\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003emmm\u003c/span\u003e\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eIn the fourth example, one of the possible answers is \u003cspan class\u003d\"tex-font-style-tt\"\u003econ\u003cspan class\u003d\"tex-font-style-bf\"\u003etest\u003c/span\u003e\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eIn the fifth example, one of the possible answers is \u003cspan class\u003d\"tex-font-style-tt\"\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003eabc\u003c/span\u003ed\u003cspan class\u003d\"tex-font-style-bf\"\u003eefg\u003c/span\u003e\u003c/span\u003e.\u003c/p\u003e"}}]}