305028: CF955B. Not simply beatiful strings

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Not simply beatiful strings

题意翻译

如果一个字符串的字母可以重新排列成两组相等的符号(注意不同的组必须包含不同的符号),那么我们就称它为可爱的字符串。例如,字符串ababa是可爱的字符串(你可以把它转换成aaabb,其中前三个字母组成一组a-s,其他字母组成一组b-b-s),但c并不是因为在每一个可能的后续分区字母中这两组是重合的。 你得到了一个字符串s。检查是否可以将其拆分为两个非空子序列,以使这些子序列形成的字符串非常可爱。这里的子序列是字符串的任意索引集。 ## 输入格式 一行由小写字母组成的s(1<=∣s∣<=10^5)。 ## 输出格式 如果字符串可以根据上述条件拆分,则输出Yes,否则输出No。 每个字母都可以用任意大小写。 @梦游的小雪球

题目描述

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. You'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.

输入输出格式

输入格式


The only line contains $ s $ $ (1<=|s|<=10^{5}) $ consisting of lowercase latin letters.

输出格式


Print «Yes» if the string can be split according to the criteria above or «No» otherwise. Each letter can be printed in arbitrary case.

输入输出样例

输入样例 #1

ababa

输出样例 #1

Yes

输入样例 #2

zzcxx

输出样例 #2

Yes

输入样例 #3

yeee

输出样例 #3

No

说明

In sample case two zzcxx can be split into subsequences zc and zxx each of which is adorable. There's no suitable partition in sample case three.

Input

题意翻译

如果一个字符串的字母可以重新排列成两组相等的符号(注意不同的组必须包含不同的符号),那么我们就称它为可爱的字符串。例如,字符串ababa是可爱的字符串(你可以把它转换成aaabb,其中前三个字母组成一组a-s,其他字母组成一组b-b-s),但c并不是因为在每一个可能的后续分区字母中这两组是重合的。 你得到了一个字符串s。检查是否可以将其拆分为两个非空子序列,以使这些子序列形成的字符串非常可爱。这里的子序列是字符串的任意索引集。 ## 输入格式 一行由小写字母组成的s(1<=∣s∣<=10^5)。 ## 输出格式 如果字符串可以根据上述条件拆分,则输出Yes,否则输出No。 每个字母都可以用任意大小写。 @梦游的小雪球

加入题单

算法标签: