{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"Consider a permutation of lowercase English letters: **P** \u003d {`p[1]`, `p[2]`, ..., `p[26]`}. Using **P**, you can generate the following sequence of strings:\r\n\r\n`S[1]` \u003d `p[1]`\r\n\r\n`S[2]` \u003d `S[1]` + `p[2]` + `S[1]`\r\n\r\n`S[3]` \u003d `S[2]` + `p[3]` + `S[2]`\r\n\r\n`...`\r\n\r\n`S[26]` \u003d `S[25]` + `p[26]` + `S[25]`\r\n\r\nIt is easy to show that the length of `S[26]` is `2^26` - **1** letters. The beginning of `S[26]` looks like `p[1]p[2]p[1]p[3]p[1]p[2]p[1]...`.\r\n\r\nYou are given a string **T** consisting of lowercase English letters. For a fixed permutation **P** you can obtain `S[26]` and then substitute some of the letters in **T** by other letters so that the resulting string becomes a substring of `S[26]`. Your goal is to minimize the number of letters that you must replace in **T** by choosing the appropriate permutation **P**.\r\n\r\n#### Input\r\nThe only line contains the string **T** (**1** ≤ |**T**| ≤ **20000**) consisting of lowercase English letters.\r\n\r\n#### Output\r\nOn the first line, print the minimal number of letters that should be replaced. On the second line, print the position in string `S[26]` where the resulting substring starts (indices start from **1**). On the third line, print the permutation **P**."}},{"title":"Example","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\u003ebaca\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\n2\nabcdefghijklmnopqrstuvwxyz\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr\u003e\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\u003ebcdbaaac\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\n2\ncbdaefghijklmnopqrstuvwxyz\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}