{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"\u003ch3\u003e Read problems statements in \u003ca target\u003d\"_blank\" href\u003d\"https://www.codechef.com/download/translated/COOK70/mandarin/TANDEM.pdf\"\u003eMandarin Chinese\u003c/a\u003e, \u003ca target\u003d\"_blank\" href\u003d\"https://www.codechef.com/download/translated/COOK70/russian/TANDEM.pdf\"\u003eRussian\u003c/a\u003e and \u003ca target\u003d\"_blank\" href\u003d\"https://www.codechef.com/download/translated/COOK70/vietnamese/TANDEM.pdf\"\u003eVietnamese\u003c/a\u003e as well.\u003c/h3\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"}},{"title":"Sample 1","value":{"format":"MD","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\u003eabaaabaaabaaabbbb\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e5 3\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cp\u003e\u003cb\u003eExample case 1.\u003c/b\u003e It is already explained in the problem statement.\u003c/p\u003e"}}]}