{"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\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cstyle type\u003d\u0027text/css\u0027\u003e .input, .output {border: 1px solid #888888;} .output {margin-bottom:1em;position:relative;top:-1px;} .output pre,.input pre {background-color:#EFEFEF;line-height:1.25em;margin:0;padding:0.25em;} .title {background-color:#FFFFFF;border-bottom: 1px solid #888888;font-family:arial;font-weight:bold;padding:0.25em;} \u003c/style\u003e \u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027]], displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027]]}\n });\n \u003c/script\u003e\n \u003cscript type\u003d\"text/javascript\" async\n src\u003d\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\"\u003e\n \u003c/script\u003e\n\u003ccenter\u003e \n\u003c/center\u003e Finally walking into the final room, Littlefish couldn\u0027t wait to open the treasure chest located in the center of the room and found an artifact from it.This artifact can only operate on a string and compress it into an \"atomic string\".\"Atomic string\" can be one of the following:\n\u003cul\u003e \n \u003cli\u003e a single string, called an \"atomic string\"; \u003c/li\u003e\n \u003cli\u003e the concatenation of two \"atomic strings\"; \u003c/li\u003e\n \u003cli\u003e the repetition of an \"atomic string\", i.e., (C)\u003csup\u003en\u003c/sup\u003e, meaning that an \"atomic string\"C appears \u003ci\u003en\u003c/i\u003e times in a row. \u003c/li\u003e\n\u003c/ul\u003e \n\u003cp\u003eNow that you have some interest in this magic tool, you now want to know what is the minimum length of the new \"atomic string\" after it has been applied to a string \u003ci\u003eS\u003c/i\u003e.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe input consists of two lines: \u003c/p\u003e\n\u003cul\u003e \n \u003cli\u003e The first line contains one integer, \u003ci\u003eN\u003c/i\u003e, the length of the \u003ci\u003eS\u003c/i\u003e. \u003c/li\u003e\n \u003cli\u003e The second line contains the string \u003ci\u003eS\u003c/i\u003e, described as a string of size \u003ci\u003eN\u003c/i\u003e. Each location is described by an alphanumeric character: either a digit (from \u00270\u0027 to \u00279\u0027), a lowercase letter (from \u0027a\u0027 to \u0027z\u0027) or an uppercase letter (from \u0027A\u0027 to \u0027Z\u0027). \u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003eLimits\u003c/span\u003e\u003c/p\u003e\n\u003cp\u003e0 \u0026lt; N ≤ 700.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eThe output should consist of a single line, whose content is an integer, the size of the shortest \"atomic string\".\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003cdiv class\u003d\"sample-test\"\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e22\naaabaaabccdaaabaaabccd\n\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e4\n\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e4\naaba\n\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e3\n\u003c/pre\u003e\n \u003c/div\u003e\n\u003c/div\u003e"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003eSample Explanation 1\u003c/span\u003e\u003c/p\u003e\n\u003cp\u003eThe shortest compressed form of the path is \u003ci\u003e(((a)\u003csup\u003e3\u003c/sup\u003e b)\u003csup\u003e2\u003c/sup\u003e (c)\u003csup\u003e2\u003c/sup\u003e d)\u003csup\u003e2\u003c/sup\u003e\u003c/i\u003e. The atomic paths it contains are a, b, c and d. Hence, it has size 4.\u003c/p\u003e\n\u003cp\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003eSample Explanation 2\u003c/span\u003e\u003c/p\u003e\n\u003cp\u003eThe shortest compressed form of the path is \u003ci\u003e(a)\u003csup\u003e2\u003c/sup\u003e ba\u003c/i\u003e. The atomic paths it contains are a, b, and a. Hence, it has size 3.\u003c/p\u003e"}}]}