{"problem":{"name":"B. Two-gram","description":{"content":"Two-gram is an ordered pair (i.e. string of length two) of capital Latin letters. For example, \"_AZ_\", \"_AA_\", \"_ZA_\" — three distinct two-grams. You are given a string $s$ consisting of $n$ capital ","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF977B"},"statements":[{"statement_type":"Markdown","content":"Two-gram is an ordered pair (i.e. string of length two) of capital Latin letters. For example, \"_AZ_\", \"_AA_\", \"_ZA_\" — three distinct two-grams.\n\nYou are given a string $s$ consisting of $n$ capital Latin letters. Your task is to find **any** two-gram contained in the given string **as a substring** (i.e. two consecutive characters of the string) maximal number of times. For example, for string $s$ = \"_BBAABBBA_\" the answer is two-gram \"_BB_\", which contained in $s$ three times. In other words, find any most frequent two-gram.\n\nNote that occurrences of the two-gram can overlap with each other.\n\n## Input\n\nThe first line of the input contains integer number $n$ ($2 \\le n \\le 100$) — the length of string $s$. The second line of the input contains the string $s$ consisting of $n$ capital Latin letters.\n\n## Output\n\nPrint the only line containing exactly two capital Latin letters — **any** two-gram contained in the given string $s$ **as a substring** (i.e. two consecutive characters of the string) maximal number of times.\n\n[samples]\n\n## Note\n\nIn the first example \"_BA_\" is also valid answer.\n\nIn the second example the only two-gram \"_ZZ_\" can be printed because it contained in the string \"_ZZZAA_\" two times.","is_translate":false,"language":"English"}],"meta":{"iden":"CF977B","tags":["implementation","strings"],"sample_group":[["7\nABACABA","AB"],["5\nZZZAA","ZZ"]],"created_at":"2026-03-03 11:00:39"}}