{"problem":{"name":"B. Not simply beatiful strings","description":{"content":"Let's call a string _adorable_ if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For exam","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF955B"},"statements":[{"statement_type":"Markdown","content":"Let's call a string _adorable_ if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For example, _ababa_ is _adorable_ (you can transform it to _aaabb_, where the first three letters form a group of _a_\\-s and others — a group of _b_\\-s), but _cccc_ is not since in each possible consequent partition letters in these two groups coincide.\n\nYou're given a string _s_. Check whether it can be split into two non-empty subsequences such that the strings formed by these subsequences are _adorable_. Here a subsequence is an arbitrary set of indexes of the string.\n\n## Input\n\nThe only line contains _s_ (1 ≤ |_s_| ≤ 105) consisting of lowercase latin letters.\n\n## Output\n\nPrint «_Yes_» if the string can be split according to the criteria above or «_No_» otherwise.\n\nEach letter can be printed in arbitrary case.\n\n[samples]\n\n## Note\n\nIn sample case two _zzcxx_ can be split into subsequences _zc_ and _zxx_ each of which is _adorable_.\n\nThere's no suitable partition in sample case three.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"我们称一个字符串为 _adorable_，如果它的字母可以重新排列，使得形成两个连续的、由相同字符组成的组（注意：不同的组必须包含不同的字符）。例如，_ababa_ 是 _adorable_ 的（你可以将其变换为 _aaabb_，其中前三个字母构成一组 #cf_span[a]-s，其余字母构成一组 #cf_span[b]-s），但 _cccc_ 不是，因为在任何可能的连续划分中，这两个组的字母都相同。\n\n给定一个字符串 #cf_span[s]。请判断它是否能被拆分为两个非空子序列，使得这两个子序列形成的字符串都是 _adorable_ 的。这里，子序列是指字符串中任意一组下标。\n\n输入仅一行，包含一个由小写拉丁字母组成的字符串 #cf_span[s] #cf_span[(1 ≤ |s| ≤ 105)]。\n\n如果字符串能按照上述标准拆分，则输出 «_Yes_»，否则输出 «_No_»。\n\n字母可以任意大小写输出。\n\n在第二个样例中，_zzcxx_ 可以被拆分为子序列 _zc_ 和 _zxx_，每个都是 _adorable_ 的。\n\n第三个样例中不存在合适的划分。\n\n## Input\n\n输入仅一行，包含一个由小写拉丁字母组成的字符串 #cf_span[s] #cf_span[(1 ≤ |s| ≤ 105)]。\n\n## Output\n\n如果字符串能按照上述标准拆分，则输出 «_Yes_»，否则输出 «_No_»。字母可以任意大小写输出。\n\n[samples]\n\n## Note\n\n在第二个样例中，_zzcxx_ 可以被拆分为子序列 _zc_ 和 _zxx_，每个都是 _adorable_ 的。第三个样例中不存在合适的划分。","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ s $ be a string of length $ n \\geq 1 $ over the alphabet $ \\Sigma = \\{a, b, \\dots, z\\} $.  \nA string $ t $ is *adorable* if there exists a permutation of $ t $ that can be written as $ x^a y^b $, where:  \n- $ x, y \\in \\Sigma $, $ x \\ne y $,  \n- $ a, b \\geq 1 $,  \n- $ x^a $ denotes $ a $ consecutive copies of $ x $,  \n- $ y^b $ denotes $ b $ consecutive copies of $ y $.  \n\nEquivalently, $ t $ is adorable if it contains exactly two distinct characters, and each appears at least once.\n\n**Given**  \nA string $ s $ of length $ n $, $ 1 \\leq n \\leq 10^5 $.\n\n**Objective**  \nDetermine whether there exists a partition of the indices of $ s $ into two non-empty disjoint subsets $ I_1, I_2 \\subset \\{1, \\dots, n\\} $, $ I_1 \\cup I_2 = \\{1, \\dots, n\\} $, such that:  \n- The subsequence $ s_{I_1} $ (formed by characters at indices in $ I_1 $) is adorable,  \n- The subsequence $ s_{I_2} $ (formed by characters at indices in $ I_2 $) is adorable.\n\n**Output**  \n“Yes” if such a partition exists; “No” otherwise.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF955B","tags":["implementation"],"sample_group":[["ababa","Yes"],["zzcxx","Yes"],["yeee","No"]],"created_at":"2026-03-03 11:00:39"}}