{"trustable":false,"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\u003eOn March 14, the day of the number $$$\\pi$$$ is celebrated all over the world. This is a very important mathematical constant equal to the ratio of the circumference of a circle to its diameter.\u003c/p\u003e\n\u003cp\u003ePolycarp was told at school that the number $$$\\pi$$$ is irrational, therefore it has an infinite number of digits in decimal notation. He wanted to prepare for the Day of the number $$$\\pi$$$ by memorizing this number as accurately as possible.\u003c/p\u003e\n\u003cp\u003ePolycarp wrote out all the digits that he managed to remember. For example, if Polycarp remembered $$$\\pi$$$ as $$$3.1415$$$, he wrote out \u003cspan class\u003d\"tex-font-style-tt\"\u003e31415\u003c/span\u003e.\u003c/p\u003e\n\u003cp\u003ePolycarp was in a hurry and could have made a mistake, so you decided to check how many first digits of the number $$$\\pi$$$ Polycarp actually remembers correctly.\u003c/p\u003e\n"}},{"title":"","value":{"format":"HTML","content":"\u003cp\u003e题目大意:给定 $$$t$$$ 个询问,每个询问给定一个字符串 $$$s(1 \\le |s| \\le 30)$$$,求该字符串与 $$$\\pi$$$ 的最长公共前缀长度。\u003c/p\u003e\n\u003cp\u003e最长公共前缀:对于两个字符串 $$$s1,s2$$$,令 $$$k$$$ 满足 $$$s1[k]\\neq s2[k]$$$ 且 $$$\\forall i(0\\le i \u003c k ),s1[i]\u003ds2[i]$$$,则最长公共前缀为 $$$k$$$ 。\u003c/p\u003e\n\u003cp\u003e$$$\\pi$$$ 前 $$$30$$$ 位为(不包括小数点):$$$314159265358979323846264338327$$$\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line of the input data contains the single integer $$$t$$$ ($$$1 \\le t \\le 10^3$$$)\u0026nbsp;— the number of test cases in the test.\u003c/p\u003e\n\u003cp\u003eEach test case is described by a single string of digits $$$n$$$, which was written out by Polycarp.\u003c/p\u003e\n\u003cp\u003eThe string $$$n$$$ contains up to $$$30$$$ digits.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eOutput $$$t$$$ integers, each of which is the answer to the corresponding test case, that is how many first digits of the number $$$\\pi$$$ Polycarp remembers correctly.\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\n000\n3\n4141592653\n141592653589793238462643383279\n31420\n31415\n314159265358\n27182\n314159265358979323846264338327\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\n1\n0\n0\n3\n5\n12\n0\n30\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}