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.

Input

The only line contains s (1 ≤ |s| ≤ 105) consisting of lowercase latin letters.

Output

Print «Yes» if the string can be split according to the criteria above or «No» otherwise.

Each letter can be printed in arbitrary case.

Examples
input
ababa
output
Yes
input
zzcxx
output
Yes
input
yeee
output
No

题意:如果能把一个字符串分成两份,每份都可以被分成只有相同字母的两块,并且这两块的字母不相同,那么输出yes,反之no。
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#define INF 0x3f3f3f3f
#define lowbit(x) (x&(-x))
#define eps 0.00000001
#define pn printf("\n")
using namespace std;
typedef long long ll; const int maxn = 1e5+;
map <char,int> mp; int main()
{
char s[maxn];
gets(s);
int len = strlen(s);
for(int i=;i<len;i++)
mp[s[i]]++;
int fl = ;
for(map<char,int>::iterator it = mp.begin(); it!=mp.end(); it++)
if(it->second == )
fl++;
if(mp.size() > ) printf("No\n");
else if(mp.size() == && fl) printf("No\n");
else if(mp.size() == ) printf("No\n");
else if(mp.size() == fl && fl% == ) printf("No\n");
else printf("Yes\n"); }

最新文章

  1. jetty9 安装部署更改端口号
  2. poj3264 - Balanced Lineup(RMQ_ST)
  3. Build 2016概览
  4. leetcode算法
  5. hdu3033 分组背包
  6. uml(1)--概述
  7. [iOS]C语言技术视频-04-程序循环结构(while{})
  8. UT源码 005
  9. 使用 dynamic 类型让 ASP.NET Core 实现 HATEOAS 结构的 RESTtful API
  10. python_pycharm下拉前置标示
  11. django rest framework批量上传图片及导入字段
  12. Mysql5.7出现this is incompatible with sql_mode=only_full_group_by
  13. Ubuntu安装openssh-server并通过xshell连接
  14. tensorboard 可视化
  15. redhat7.0安装ifconfig
  16. 【OpenPose-Windows】运行OpenposeDemo.exe 如何保存图像运行结果及关节点信息
  17. OpenSSL编程
  18. TCP Over HTTP 的Buffer问题
  19. Final阶段中间产物
  20. History of programming language

热门文章

  1. 第三次训练 密码acmore
  2. Nikita and stack
  3. 0709MySQL 数据库性能优化之表结构优化
  4. JAVA必背面试题和项目面试通关要点(带答案)
  5. poj 2135 Farm Tour 【无向图最小费用最大流】
  6. Android开机键失灵启动手机的解决的方法
  7. viz.js操作流程
  8. Windows 平台下 Go 语言的安装和环境变量设置
  9. nyoj--635--Oh, my goddess(dfs)
  10. [BZOJ 2100] Apple Delivery