{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eString is a very useful thing and a subsequence of the same string is equally important.\u003c/p\u003e\n\u003cp\u003eNow you have a string $s$ with length $n$ and a string $t$ with length $m$. Find out the longest subsequence in the string $s$ so that the lexicographical order of this subsequence is strictly larger than $t$.\u003c/p\u003e\n\u003ch3\u003eInput\u003c/h3\u003e\n\u003cp\u003etwo integers $n$, $m$ in the first line\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e(All characters are lowercase letters)\u003c/p\u003e\n\u003cp\u003eThe second line is a string $s$\u003c/p\u003e\n\u003cp\u003eThe third line is a string $t$\u003c/p\u003e\n\u003cul\u003e\n \u003cli\u003e$1 \\le n,m \\le 10^6$\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch3\u003eOutput\u003c/h3\u003e\n\u003cp\u003eOutput an integer representing the longest length, otherwise output \u003ccode\u003e-1\u003c/code\u003e.\u003c/p\u003e"}},{"title":"Sample 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\u003e9 3\naaabbbccc\nabc\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e6\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr /\u003e"}},{"title":"Sample 2","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\u003e9 3\naaabbbccc\nzzz\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e-1\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr /\u003e"}}]}