{"trustable":false,"sections":[{"title":"","value":{"format":"MD","content":"\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n \"HTML-CSS\": {\n preferredFont: \"TeX\",\n availableFonts: [\"STIX\",\"TeX\"],\n linebreaks: { automatic:true },\n EqnChunk: (MathJax.Hub.Browser.isMobile ? 10 : 50)\n },\n ShowMathMenu: false,\n TeX: {\n extensions: [\"color.js\"],\n noUndefined: {\n attributes: {\n mathcolor: \"red\",\n mathbackground: \"#FFEEEE\",\n mathsize: \"90%\"\n }\n },\n Macros: { href: \"{}\" }\n },\n tex2jax: {\n inlineMath: [[\u0027$\u0027,\u0027$\u0027], [\u0027\\\\(\u0027,\u0027\\\\)\u0027]],\n displayMath: [ [\"$$\",\"$$\"], [\"\\\\[\", \"\\\\]\"] ],\n multiline: true,\n processEscapes: true\n },\n menuSettings: {\n context: \"Browser\"\n },\n messageStyle: \"none\"\n });\n \u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" src\u003d\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\"\u003e\u003c/script\u003e\n\u003cp\u003e\nThe chef was recently studying about repeated occurrences of substrings in the strings. In particular, he was studying about a string \u003cb\u003es\u003c/b\u003e.\n\u003c/p\u003e\n\u003cp\u003e\nHe calls a string to be in tandem if it can be represented as concatenation of three equal strings, i.e. it can be represented as \u003cb\u003eAAA\u003c/b\u003e where \u003cb\u003eA\u003c/b\u003e is a non-empty string. For brevity, he calls such strings \u003ci\u003etandem\u003c/i\u003e strings. For example, \"ababab\" is a \u003ci\u003etandem\u003c/i\u003e string whereas \"abab\" is not.\n\u003c/p\u003e\n\u003cp\u003e\nNow, Chef is studying \u003ci\u003etandem\u003c/i\u003e substrings of string \u003cb\u003es\u003c/b\u003e. He calls a \u003ci\u003etandem\u003c/i\u003e substring an \u003ci\u003einteresting tandem\u003c/i\u003e if the character following the substring in string \u003cb\u003es\u003c/b\u003e (if it exists) is different than the first character of the substring. If the character following the \u003ci\u003etandem\u003c/i\u003e substring does not exist (i.e. the substring appears as a suffix of string \u003cb\u003es\u003c/b\u003e), it\u0027s also called \u003ci\u003einteresting\u003c/i\u003e tandem.\n\u003c/p\u003e\n\u003cp\u003e\nChef calls all the \u003ci\u003etandem\u003c/i\u003e substrings which are not \u003ci\u003einteresting tandem\u003c/i\u003e as \u003ci\u003eboring tandems\u003c/i\u003e.\n\u003c/p\u003e\n\u003cp\u003e\nNow, chef wants your help in counting number of \u003ci\u003einteresting\u003c/i\u003e and \u003ci\u003eboring\u003c/i\u003e tandem substrings in string \u003cb\u003es\u003c/b\u003e. Please help him!!\n\u003c/p\u003e\n\u003cp\u003e\nFor example, let \u003cb\u003es\u003c/b\u003e be \u003cb\u003e\"abaaabaaabaaabbbb\"\u003c/b\u003e.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eThe substring \u003cb\u003es[3..14] \u003d \"aaabaaabaaab\"\u003c/b\u003e is an \u003ci\u003einteresting tandem\u003c/i\u003e, as the substring is a \u003ci\u003etandem\u003c/i\u003e and the character following the substring (i.e. \u003cb\u003es[15] \u003d \u0027b\u0027\u003c/b\u003e) is different than the first character of the substring (i.e. \u003cb\u003e\u0027a\u0027\u003c/b\u003e).\u003c/li\u003e\n\u003cli\u003eThe substring \u003cb\u003es[1..12] \u003d \"abaaabaaabaa\"\u003c/b\u003e is a \u003ci\u003eboring tandem\u003c/i\u003e, as the character following the \u003ci\u003etandem\u003c/i\u003e substring (i.e. \u003cb\u003es[13] \u003d \u0027a\u0027\u003c/b\u003e) is same as the first character of the substring (i.e. \u003cb\u003e\u0027a\u0027\u003c/b\u003e).\u003c/li\u003e\n\u003cli\u003eThe substring \u003cb\u003es[15..17] \u003d \"bbb\"\u003c/b\u003e is also an \u003ci\u003einteresting tandem\u003c/i\u003e as the character following the tandem does not exist (i.e. this tandem substring appears as a suffix of string \u003cb\u003es\u003c/b\u003e).\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003eIn summary, \u003cb\u003es[1..12], s[2..13], s[3..14], s[3..5], s[7..9], s[11..13], s[14..16], s[15..17]\u003c/b\u003e are all \u003ci\u003etandem\u003c/i\u003e substrings. Out of which, \u003cb\u003es[3..14], s[3..5], s[7..9], s[11..13], s[15..17]\u003c/b\u003e are all \u003ci\u003einteresting tandems\u003c/i\u003e. Rest \u003ci\u003etandem\u003c/i\u003e substrings, \u003cb\u003es[1..12], s[2..13], s[14..16]\u003c/b\u003e are all \u003ci\u003eboring tandems\u003c/i\u003e.\u003c/p\u003e\n\u003ch3\u003eInput\u003c/h3\u003e\n\u003cp\u003eThere is only a single test case.\u003c/p\u003e\n\u003cp\u003eThe first line of the input contains a string \u003cb\u003es\u003c/b\u003e.\u003c/p\u003e\n\u003ch3\u003eOutput\u003c/h3\u003e\n\u003cp\u003eThe only line of the output should contain two space separated integers denoting the number of \u003ci\u003einteresting\u003c/i\u003e and \u003ci\u003eboring\u003c/i\u003e tandems in string, respectively.\u003c/p\u003e\n\u003ch3\u003eConstraints\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cb\u003e1\u003c/b\u003e ≤ \u003cb\u003e|s|\u003c/b\u003e ≤ \u003cb\u003e200000\u003c/b\u003e\u003c/li\u003e\n\u003cli\u003e\u003cb\u003es\u003c/b\u003e consists of lower case English alphabets (\u0027a\u0027 to \u0027z\u0027)\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch3\u003eExample\u003c/h3\u003e\n\u003cpre\u003e\u003cb\u003eInput:\u003c/b\u003e\nabaaabaaabaaabbbb\n\n\u003cb\u003eOutput:\u003c/b\u003e\n5 3\n\u003c/pre\u003e\u003ch3\u003eExplanation\u003c/h3\u003e\n\u003cp\u003e\u003cb\u003eExample case 1.\u003c/b\u003e It is already explained in the problem statement.\u003c/p\u003e\n\n\u003caside style\u003d\u0027background: #f8f8f8;padding: 10px 15px;\u0027\u003e\u003cdiv\u003e\u003c/div\u003e\u003c/aside\u003e"}}]}