{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"challenge_problem_statement\"\u003e\u003cdiv class\u003d\"msB challenge_problem_statement_body\"\u003e\u003cdiv class\u003d\"hackdown-content\"\u003e\u003cstyle id\u003d\"MathJax_SVG_styles\"\u003e.MathJax_SVG_Display {text-align: center; margin: 1em 0em; position: relative; display: block!important; text-indent: 0; max-width: none; max-height: none; min-width: 0; min-height: 0; width: 100%}\n.MathJax_SVG .MJX-monospace {font-family: monospace}\n.MathJax_SVG .MJX-sans-serif {font-family: sans-serif}\n.MathJax_SVG {display: inline; font-style: normal; font-weight: normal; line-height: normal; font-size: 100%; font-size-adjust: none; text-indent: 0; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0; min-height: 0; border: 0; padding: 0; margin: 0}\n.MathJax_SVG * {transition: none; -webkit-transition: none; -moz-transition: none; -ms-transition: none; -o-transition: none}\n.mjx-svg-href {fill: blue; stroke: blue}\n\u003c/style\u003e\u003csvg style\u003d\"display: none;\"\u003e\u003cdefs id\u003d\"MathJax_SVG_glyphs\"\u003e\u003c/defs\u003e\u003c/svg\u003e\u003cp\u003eA string is made of only lowercase latin letters (a,b,c,d,.....,z). Can you find the length of the lexicographically smallest string such that it has exactly \u003cspan style\u003d\"font-size: 100%; display: inline-block;\" class\u003d\"MathJax_SVG\" id\u003d\"MathJax-Element-1-Frame\"\u003e\u003csvg xmlns:xlink\u003d\"http://www.w3.org/1999/xlink\" width\u003d\"2.066ex\" height\u003d\"2.176ex\" style\u003d\"vertical-align: -0.338ex;\" viewBox\u003d\"0 -791.3 889.5 936.9\" role\u003d\"img\" focusable\u003d\"false\"\u003e\u003cg stroke\u003d\"currentColor\" fill\u003d\"currentColor\" stroke-width\u003d\"0\" transform\u003d\"matrix(1 0 0 -1 0 0)\"\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M285 628Q285 635 228 637Q205 637 198 638T191 647Q191 649 193 661Q199 681 203 682Q205 683 214 683H219Q260 681 355 681Q389 681 418 681T463 682T483 682Q500 682 500 674Q500 669 497 660Q496 658 496 654T495 648T493 644T490 641T486 639T479 638T470 637T456 637Q416 636 405 634T387 623L306 305Q307 305 490 449T678 597Q692 611 692 620Q692 635 667 637Q651 637 651 648Q651 650 654 662T659 677Q662 682 676 682Q680 682 711 681T791 680Q814 680 839 681T869 682Q889 682 889 672Q889 650 881 642Q878 637 862 637Q787 632 726 586Q710 576 656 534T556 455L509 418L518 396Q527 374 546 329T581 244Q656 67 661 61Q663 59 666 57Q680 47 717 46H738Q744 38 744 37T741 19Q737 6 731 0H720Q680 3 625 3Q503 3 488 0H478Q472 6 472 9T474 27Q478 40 480 43T491 46H494Q544 46 544 71Q544 75 517 141T485 216L427 354L359 301L291 248L268 155Q245 63 245 58Q245 51 253 49T303 46H334Q340 37 340 35Q340 19 333 5Q328 0 317 0Q314 0 280 1T180 2Q118 2 85 2T49 1Q31 1 31 11Q31 13 34 25Q38 41 42 43T65 46Q92 46 125 49Q139 52 144 61Q147 65 216 339T285 628Z\"\u003e\u003c/path\u003e\u003c/g\u003e\u003c/svg\u003e\u003c/span\u003e sub-strings, each of which are palindromes? \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"challenge_input_format\"\u003e\u003cdiv class\u003d\"msB challenge_input_format_title\"\u003e\u003cp\u003e\u003cstrong\u003eInput Format\u003c/strong\u003e\u003c/p\u003e\u003c/div\u003e\u003cdiv class\u003d\"msB challenge_input_format_body\"\u003e\u003cdiv class\u003d\"hackdown-content\"\u003e\u003cstyle id\u003d\"MathJax_SVG_styles\"\u003e.MathJax_SVG_Display {text-align: center; margin: 1em 0em; position: relative; display: block!important; text-indent: 0; max-width: none; max-height: none; min-width: 0; min-height: 0; width: 100%}\n.MathJax_SVG .MJX-monospace {font-family: monospace}\n.MathJax_SVG .MJX-sans-serif {font-family: sans-serif}\n.MathJax_SVG {display: inline; font-style: normal; font-weight: normal; line-height: normal; font-size: 100%; font-size-adjust: none; text-indent: 0; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0; min-height: 0; border: 0; padding: 0; margin: 0}\n.MathJax_SVG * {transition: none; -webkit-transition: none; -moz-transition: none; -ms-transition: none; -o-transition: none}\n.mjx-svg-href {fill: blue; stroke: blue}\n\u003c/style\u003e\u003csvg style\u003d\"display: none;\"\u003e\u003cdefs id\u003d\"MathJax_SVG_glyphs\"\u003e\u003c/defs\u003e\u003c/svg\u003e\u003cp\u003eThe first line of input contains single integer \u003cspan style\u003d\"font-size: 100%; display: inline-block;\" class\u003d\"MathJax_SVG\" id\u003d\"MathJax-Element-1-Frame\"\u003e\u003csvg xmlns:xlink\u003d\"http://www.w3.org/1999/xlink\" width\u003d\"1.636ex\" height\u003d\"2.176ex\" style\u003d\"vertical-align: -0.338ex;\" viewBox\u003d\"0 -791.3 704.5 936.9\" role\u003d\"img\" focusable\u003d\"false\"\u003e\u003cg stroke\u003d\"currentColor\" fill\u003d\"currentColor\" stroke-width\u003d\"0\" transform\u003d\"matrix(1 0 0 -1 0 0)\"\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M40 437Q21 437 21 445Q21 450 37 501T71 602L88 651Q93 669 101 677H569H659Q691 677 697 676T704 667Q704 661 687 553T668 444Q668 437 649 437Q640 437 637 437T631 442L629 445Q629 451 635 490T641 551Q641 586 628 604T573 629Q568 630 515 631Q469 631 457 630T439 622Q438 621 368 343T298 60Q298 48 386 46Q418 46 427 45T436 36Q436 31 433 22Q429 4 424 1L422 0Q419 0 415 0Q410 0 363 1T228 2Q99 2 64 0H49Q43 6 43 9T45 27Q49 40 55 46H83H94Q174 46 189 55Q190 56 191 56Q196 59 201 76T241 233Q258 301 269 344Q339 619 339 625Q339 630 310 630H279Q212 630 191 624Q146 614 121 583T67 467Q60 445 57 441T43 437H40Z\"\u003e\u003c/path\u003e\u003c/g\u003e\u003c/svg\u003e\u003c/span\u003e - the number of testcases. \u003cbr\u003e\nT lines follow, each containing the integer \u003cspan style\u003d\"font-size: 100%; display: inline-block;\" class\u003d\"MathJax_SVG\" id\u003d\"MathJax-Element-2-Frame\"\u003e\u003csvg xmlns:xlink\u003d\"http://www.w3.org/1999/xlink\" width\u003d\"2.066ex\" height\u003d\"2.176ex\" style\u003d\"vertical-align: -0.338ex;\" viewBox\u003d\"0 -791.3 889.5 936.9\" role\u003d\"img\" focusable\u003d\"false\"\u003e\u003cg stroke\u003d\"currentColor\" fill\u003d\"currentColor\" stroke-width\u003d\"0\" transform\u003d\"matrix(1 0 0 -1 0 0)\"\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M285 628Q285 635 228 637Q205 637 198 638T191 647Q191 649 193 661Q199 681 203 682Q205 683 214 683H219Q260 681 355 681Q389 681 418 681T463 682T483 682Q500 682 500 674Q500 669 497 660Q496 658 496 654T495 648T493 644T490 641T486 639T479 638T470 637T456 637Q416 636 405 634T387 623L306 305Q307 305 490 449T678 597Q692 611 692 620Q692 635 667 637Q651 637 651 648Q651 650 654 662T659 677Q662 682 676 682Q680 682 711 681T791 680Q814 680 839 681T869 682Q889 682 889 672Q889 650 881 642Q878 637 862 637Q787 632 726 586Q710 576 656 534T556 455L509 418L518 396Q527 374 546 329T581 244Q656 67 661 61Q663 59 666 57Q680 47 717 46H738Q744 38 744 37T741 19Q737 6 731 0H720Q680 3 625 3Q503 3 488 0H478Q472 6 472 9T474 27Q478 40 480 43T491 46H494Q544 46 544 71Q544 75 517 141T485 216L427 354L359 301L291 248L268 155Q245 63 245 58Q245 51 253 49T303 46H334Q340 37 340 35Q340 19 333 5Q328 0 317 0Q314 0 280 1T180 2Q118 2 85 2T49 1Q31 1 31 11Q31 13 34 25Q38 41 42 43T65 46Q92 46 125 49Q139 52 144 61Q147 65 216 339T285 628Z\"\u003e\u003c/path\u003e\u003c/g\u003e\u003c/svg\u003e\u003c/span\u003e.\u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"challenge_constraints\"\u003e\u003cdiv class\u003d\"msB challenge_constraints_title\"\u003e\u003cp\u003e\u003cstrong\u003eConstraints\u003c/strong\u003e\u003c/p\u003e\u003c/div\u003e\u003cdiv class\u003d\"msB challenge_constraints_body\"\u003e\u003cdiv class\u003d\"hackdown-content\"\u003e\u003cstyle id\u003d\"MathJax_SVG_styles\"\u003e.MathJax_SVG_Display {text-align: center; margin: 1em 0em; position: relative; display: block!important; text-indent: 0; max-width: none; max-height: none; min-width: 0; min-height: 0; width: 100%}\n.MathJax_SVG .MJX-monospace {font-family: monospace}\n.MathJax_SVG .MJX-sans-serif {font-family: sans-serif}\n.MathJax_SVG {display: inline; font-style: normal; font-weight: normal; line-height: normal; font-size: 100%; font-size-adjust: none; text-indent: 0; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0; min-height: 0; border: 0; padding: 0; margin: 0}\n.MathJax_SVG * {transition: none; -webkit-transition: none; -moz-transition: none; -ms-transition: none; -o-transition: none}\n.mjx-svg-href {fill: blue; stroke: blue}\n\u003c/style\u003e\u003csvg style\u003d\"display: none;\"\u003e\u003cdefs id\u003d\"MathJax_SVG_glyphs\"\u003e\u003c/defs\u003e\u003c/svg\u003e\u003cul\u003e\n\u003cli\u003e\u003cspan style\u003d\"font-size: 100%; display: inline-block;\" class\u003d\"MathJax_SVG\" id\u003d\"MathJax-Element-1-Frame\"\u003e\u003csvg xmlns:xlink\u003d\"http://www.w3.org/1999/xlink\" width\u003d\"12.483ex\" height\u003d\"2.343ex\" style\u003d\"vertical-align: -0.505ex;\" viewBox\u003d\"0 -791.3 5374.6 1008.6\" role\u003d\"img\" focusable\u003d\"false\"\u003e\u003cg stroke\u003d\"currentColor\" fill\u003d\"currentColor\" stroke-width\u003d\"0\" transform\u003d\"matrix(1 0 0 -1 0 0)\"\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z\"\u003e\u003c/path\u003e\u003cg transform\u003d\"translate(778,0)\"\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M674 636Q682 636 688 630T694 615T687 601Q686 600 417 472L151 346L399 228Q687 92 691 87Q694 81 694 76Q694 58 676 56H670L382 192Q92 329 90 331Q83 336 83 348Q84 359 96 365Q104 369 382 500T665 634Q669 636 674 636ZM84 -118Q84 -108 99 -98H678Q694 -104 694 -118Q694 -130 679 -138H98Q84 -131 84 -118Z\"\u003e\u003c/path\u003e\u003c/g\u003e\u003cg transform\u003d\"translate(1834,0)\"\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M40 437Q21 437 21 445Q21 450 37 501T71 602L88 651Q93 669 101 677H569H659Q691 677 697 676T704 667Q704 661 687 553T668 444Q668 437 649 437Q640 437 637 437T631 442L629 445Q629 451 635 490T641 551Q641 586 628 604T573 629Q568 630 515 631Q469 631 457 630T439 622Q438 621 368 343T298 60Q298 48 386 46Q418 46 427 45T436 36Q436 31 433 22Q429 4 424 1L422 0Q419 0 415 0Q410 0 363 1T228 2Q99 2 64 0H49Q43 6 43 9T45 27Q49 40 55 46H83H94Q174 46 189 55Q190 56 191 56Q196 59 201 76T241 233Q258 301 269 344Q339 619 339 625Q339 630 310 630H279Q212 630 191 624Q146 614 121 583T67 467Q60 445 57 441T43 437H40Z\"\u003e\u003c/path\u003e\u003c/g\u003e\u003cg transform\u003d\"translate(2816,0)\"\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M674 636Q682 636 688 630T694 615T687 601Q686 600 417 472L151 346L399 228Q687 92 691 87Q694 81 694 76Q694 58 676 56H670L382 192Q92 329 90 331Q83 336 83 348Q84 359 96 365Q104 369 382 500T665 634Q669 636 674 636ZM84 -118Q84 -108 99 -98H678Q694 -104 694 -118Q694 -130 679 -138H98Q84 -131 84 -118Z\"\u003e\u003c/path\u003e\u003c/g\u003e\u003cg transform\u003d\"translate(3873,0)\"\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z\"\u003e\u003c/path\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z\" transform\u003d\"translate(500,0)\"\u003e\u003c/path\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z\" transform\u003d\"translate(1001,0)\"\u003e\u003c/path\u003e\u003c/g\u003e\u003c/g\u003e\u003c/svg\u003e\u003c/span\u003e \u003c/li\u003e\n\u003cli\u003e\u003cspan style\u003d\"font-size: 100%; display: inline-block;\" class\u003d\"MathJax_SVG\" id\u003d\"MathJax-Element-2-Frame\"\u003e\u003csvg xmlns:xlink\u003d\"http://www.w3.org/1999/xlink\" width\u003d\"13.626ex\" height\u003d\"2.843ex\" style\u003d\"vertical-align: -0.505ex;\" viewBox\u003d\"0 -1006.6 5866.9 1223.9\" role\u003d\"img\" focusable\u003d\"false\"\u003e\u003cg stroke\u003d\"currentColor\" fill\u003d\"currentColor\" stroke-width\u003d\"0\" transform\u003d\"matrix(1 0 0 -1 0 0)\"\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z\"\u003e\u003c/path\u003e\u003cg transform\u003d\"translate(778,0)\"\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M674 636Q682 636 688 630T694 615T687 601Q686 600 417 472L151 346L399 228Q687 92 691 87Q694 81 694 76Q694 58 676 56H670L382 192Q92 329 90 331Q83 336 83 348Q84 359 96 365Q104 369 382 500T665 634Q669 636 674 636ZM84 -118Q84 -108 99 -98H678Q694 -104 694 -118Q694 -130 679 -138H98Q84 -131 84 -118Z\"\u003e\u003c/path\u003e\u003c/g\u003e\u003cg transform\u003d\"translate(1834,0)\"\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M285 628Q285 635 228 637Q205 637 198 638T191 647Q191 649 193 661Q199 681 203 682Q205 683 214 683H219Q260 681 355 681Q389 681 418 681T463 682T483 682Q500 682 500 674Q500 669 497 660Q496 658 496 654T495 648T493 644T490 641T486 639T479 638T470 637T456 637Q416 636 405 634T387 623L306 305Q307 305 490 449T678 597Q692 611 692 620Q692 635 667 637Q651 637 651 648Q651 650 654 662T659 677Q662 682 676 682Q680 682 711 681T791 680Q814 680 839 681T869 682Q889 682 889 672Q889 650 881 642Q878 637 862 637Q787 632 726 586Q710 576 656 534T556 455L509 418L518 396Q527 374 546 329T581 244Q656 67 661 61Q663 59 666 57Q680 47 717 46H738Q744 38 744 37T741 19Q737 6 731 0H720Q680 3 625 3Q503 3 488 0H478Q472 6 472 9T474 27Q478 40 480 43T491 46H494Q544 46 544 71Q544 75 517 141T485 216L427 354L359 301L291 248L268 155Q245 63 245 58Q245 51 253 49T303 46H334Q340 37 340 35Q340 19 333 5Q328 0 317 0Q314 0 280 1T180 2Q118 2 85 2T49 1Q31 1 31 11Q31 13 34 25Q38 41 42 43T65 46Q92 46 125 49Q139 52 144 61Q147 65 216 339T285 628Z\"\u003e\u003c/path\u003e\u003c/g\u003e\u003cg transform\u003d\"translate(3001,0)\"\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M674 636Q682 636 688 630T694 615T687 601Q686 600 417 472L151 346L399 228Q687 92 691 87Q694 81 694 76Q694 58 676 56H670L382 192Q92 329 90 331Q83 336 83 348Q84 359 96 365Q104 369 382 500T665 634Q669 636 674 636ZM84 -118Q84 -108 99 -98H678Q694 -104 694 -118Q694 -130 679 -138H98Q84 -131 84 -118Z\"\u003e\u003c/path\u003e\u003c/g\u003e\u003cg transform\u003d\"translate(4058,0)\"\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z\"\u003e\u003c/path\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z\" transform\u003d\"translate(500,0)\"\u003e\u003c/path\u003e\u003cg transform\u003d\"translate(1001,393)\"\u003e\u003cpath stroke-width\u003d\"1\" transform\u003d\"scale(0.707)\" d\u003d\"M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z\"\u003e\u003c/path\u003e\u003cpath stroke-width\u003d\"1\" transform\u003d\"translate(353,0) scale(0.707)\" d\u003d\"M109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429Z\"\u003e\u003c/path\u003e\u003c/g\u003e\u003c/g\u003e\u003c/g\u003e\u003c/svg\u003e\u003c/span\u003e \u003c/li\u003e\n\u003c/ul\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"challenge_output_format\"\u003e\u003cdiv class\u003d\"msB challenge_output_format_title\"\u003e\u003cp\u003e\u003cstrong\u003eOutput Format\u003c/strong\u003e\u003c/p\u003e\u003c/div\u003e\u003cdiv class\u003d\"msB challenge_output_format_body\"\u003e\u003cdiv class\u003d\"hackdown-content\"\u003e\u003cstyle id\u003d\"MathJax_SVG_styles\"\u003e.MathJax_SVG_Display {text-align: center; margin: 1em 0em; position: relative; display: block!important; text-indent: 0; max-width: none; max-height: none; min-width: 0; min-height: 0; width: 100%}\n.MathJax_SVG .MJX-monospace {font-family: monospace}\n.MathJax_SVG .MJX-sans-serif {font-family: sans-serif}\n.MathJax_SVG {display: inline; font-style: normal; font-weight: normal; line-height: normal; font-size: 100%; font-size-adjust: none; text-indent: 0; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0; min-height: 0; border: 0; padding: 0; margin: 0}\n.MathJax_SVG * {transition: none; -webkit-transition: none; -moz-transition: none; -ms-transition: none; -o-transition: none}\n.mjx-svg-href {fill: blue; stroke: blue}\n\u003c/style\u003e\u003csvg style\u003d\"display: none;\"\u003e\u003cdefs id\u003d\"MathJax_SVG_glyphs\"\u003e\u003c/defs\u003e\u003c/svg\u003e\u003cp\u003eOutput exactly \u003cspan style\u003d\"font-size: 100%; display: inline-block;\" class\u003d\"MathJax_SVG\" id\u003d\"MathJax-Element-1-Frame\"\u003e\u003csvg xmlns:xlink\u003d\"http://www.w3.org/1999/xlink\" width\u003d\"1.636ex\" height\u003d\"2.176ex\" style\u003d\"vertical-align: -0.338ex;\" viewBox\u003d\"0 -791.3 704.5 936.9\" role\u003d\"img\" focusable\u003d\"false\"\u003e\u003cg stroke\u003d\"currentColor\" fill\u003d\"currentColor\" stroke-width\u003d\"0\" transform\u003d\"matrix(1 0 0 -1 0 0)\"\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M40 437Q21 437 21 445Q21 450 37 501T71 602L88 651Q93 669 101 677H569H659Q691 677 697 676T704 667Q704 661 687 553T668 444Q668 437 649 437Q640 437 637 437T631 442L629 445Q629 451 635 490T641 551Q641 586 628 604T573 629Q568 630 515 631Q469 631 457 630T439 622Q438 621 368 343T298 60Q298 48 386 46Q418 46 427 45T436 36Q436 31 433 22Q429 4 424 1L422 0Q419 0 415 0Q410 0 363 1T228 2Q99 2 64 0H49Q43 6 43 9T45 27Q49 40 55 46H83H94Q174 46 189 55Q190 56 191 56Q196 59 201 76T241 233Q258 301 269 344Q339 619 339 625Q339 630 310 630H279Q212 630 191 624Q146 614 121 583T67 467Q60 445 57 441T43 437H40Z\"\u003e\u003c/path\u003e\u003c/g\u003e\u003c/svg\u003e\u003c/span\u003e lines. Each line should contain single integer - the length of the lexicographically smallest string.\u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003ctable class\u003d\"vjudge_sample\"\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\u003e2\n10\n17\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\n7\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\u003cdiv class\u003d\"challenge_explanation\"\u003e\u003cdiv class\u003d\"msB challenge_explanation_title\"\u003e\u003cp\u003e\u003cstrong\u003eExplanation\u003c/strong\u003e\u003c/p\u003e\u003c/div\u003e\u003cdiv class\u003d\"msB challenge_explanation_body\"\u003e\u003cdiv class\u003d\"hackdown-content\"\u003e\u003cstyle id\u003d\"MathJax_SVG_styles\"\u003e.MathJax_SVG_Display {text-align: center; margin: 1em 0em; position: relative; display: block!important; text-indent: 0; max-width: none; max-height: none; min-width: 0; min-height: 0; width: 100%}\n.MathJax_SVG .MJX-monospace {font-family: monospace}\n.MathJax_SVG .MJX-sans-serif {font-family: sans-serif}\n.MathJax_SVG {display: inline; font-style: normal; font-weight: normal; line-height: normal; font-size: 100%; font-size-adjust: none; text-indent: 0; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0; min-height: 0; border: 0; padding: 0; margin: 0}\n.MathJax_SVG * {transition: none; -webkit-transition: none; -moz-transition: none; -ms-transition: none; -o-transition: none}\n.mjx-svg-href {fill: blue; stroke: blue}\n\u003c/style\u003e\u003csvg style\u003d\"display: none;\"\u003e\u003cdefs id\u003d\"MathJax_SVG_glyphs\"\u003e\u003c/defs\u003e\u003c/svg\u003e\u003cp\u003efor \u003cspan style\u003d\"font-size: 100%; display: inline-block;\" class\u003d\"MathJax_SVG\" id\u003d\"MathJax-Element-1-Frame\"\u003e\u003csvg xmlns:xlink\u003d\"http://www.w3.org/1999/xlink\" width\u003d\"7.489ex\" height\u003d\"2.176ex\" style\u003d\"vertical-align: -0.338ex;\" viewBox\u003d\"0 -791.3 3224.6 936.9\" role\u003d\"img\" focusable\u003d\"false\"\u003e\u003cg stroke\u003d\"currentColor\" fill\u003d\"currentColor\" stroke-width\u003d\"0\" transform\u003d\"matrix(1 0 0 -1 0 0)\"\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M285 628Q285 635 228 637Q205 637 198 638T191 647Q191 649 193 661Q199 681 203 682Q205 683 214 683H219Q260 681 355 681Q389 681 418 681T463 682T483 682Q500 682 500 674Q500 669 497 660Q496 658 496 654T495 648T493 644T490 641T486 639T479 638T470 637T456 637Q416 636 405 634T387 623L306 305Q307 305 490 449T678 597Q692 611 692 620Q692 635 667 637Q651 637 651 648Q651 650 654 662T659 677Q662 682 676 682Q680 682 711 681T791 680Q814 680 839 681T869 682Q889 682 889 672Q889 650 881 642Q878 637 862 637Q787 632 726 586Q710 576 656 534T556 455L509 418L518 396Q527 374 546 329T581 244Q656 67 661 61Q663 59 666 57Q680 47 717 46H738Q744 38 744 37T741 19Q737 6 731 0H720Q680 3 625 3Q503 3 488 0H478Q472 6 472 9T474 27Q478 40 480 43T491 46H494Q544 46 544 71Q544 75 517 141T485 216L427 354L359 301L291 248L268 155Q245 63 245 58Q245 51 253 49T303 46H334Q340 37 340 35Q340 19 333 5Q328 0 317 0Q314 0 280 1T180 2Q118 2 85 2T49 1Q31 1 31 11Q31 13 34 25Q38 41 42 43T65 46Q92 46 125 49Q139 52 144 61Q147 65 216 339T285 628Z\"\u003e\u003c/path\u003e\u003cg transform\u003d\"translate(1167,0)\"\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z\"\u003e\u003c/path\u003e\u003c/g\u003e\u003cg transform\u003d\"translate(2223,0)\"\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z\"\u003e\u003c/path\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z\" transform\u003d\"translate(500,0)\"\u003e\u003c/path\u003e\u003c/g\u003e\u003c/g\u003e\u003c/svg\u003e\u003c/span\u003e, one of the smallest possible strings that satisfies the property is \u003ccode\u003eaaaa\u003c/code\u003e. \nAll \u003cspan style\u003d\"font-size: 100%; display: inline-block;\" class\u003d\"MathJax_SVG\" id\u003d\"MathJax-Element-2-Frame\"\u003e\u003csvg xmlns:xlink\u003d\"http://www.w3.org/1999/xlink\" width\u003d\"2.325ex\" height\u003d\"2.176ex\" style\u003d\"vertical-align: -0.338ex;\" viewBox\u003d\"0 -791.3 1001 936.9\" role\u003d\"img\" focusable\u003d\"false\"\u003e\u003cg stroke\u003d\"currentColor\" fill\u003d\"currentColor\" stroke-width\u003d\"0\" transform\u003d\"matrix(1 0 0 -1 0 0)\"\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z\"\u003e\u003c/path\u003e\u003cpath stroke-width\u003d\"1\" d\u003d\"M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z\" transform\u003d\"translate(500,0)\"\u003e\u003c/path\u003e\u003c/g\u003e\u003c/svg\u003e\u003c/span\u003e palindromes are \u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003ea,a,a,a \u003c/li\u003e\n\u003cli\u003eaa, aa, aa\u003c/li\u003e\n\u003cli\u003eaaa, aaa\u003c/li\u003e\n\u003cli\u003eaaaa\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003e\u003cstrong\u003eNote\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eTwo sub-strings with different indices are both counted. \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e"}}]}