地址:http://codeforces.com/contest/765/problem/B

题目:

B. Code obfuscation
time limit per test

2 seconds

memory limit per test

512 megabytes

input

standard input

output

standard output

Kostya likes Codeforces contests very much. However, he is very disappointed that his solutions are frequently hacked. That's why he decided to obfuscate (intentionally make less readable) his code before upcoming contest.

To obfuscate the code, Kostya first looks at the first variable name used in his program and replaces all its occurrences with a single symbol a, then he looks at the second variable name that has not been replaced yet, and replaces all its occurrences with b, and so on. Kostya is well-mannered, so he doesn't use any one-letter names before obfuscation. Moreover, there are at most 26 unique identifiers in his programs.

You are given a list of identifiers of some program with removed spaces and line breaks. Check if this program can be a result of Kostya's obfuscation.

Input

In the only line of input there is a string S of lowercase English letters (1 ≤ |S| ≤ 500) — the identifiers of a program with removed whitespace characters.

Output

If this program can be a result of Kostya's obfuscation, print "YES" (without quotes), otherwise print "NO".

Examples
input
abacaba
output
YES
input
jinotega
output
NO
Note

In the first sample case, one possible list of identifiers would be "number string number character number string number". Here how Kostya would obfuscate the program:

  • replace all occurences of number with a, the result would be "a string a character a string a",
  • replace all occurences of string with b, the result would be "a b a character a b a",
  • replace all occurences of character with c, the result would be "a b a c a b a",
  • all identifiers have been replaced, thus the obfuscation is finished.

思路:如果合法,出现的最大字母依次是a,b,c,d....

  直接扫一遍即可

 #include <bits/stdc++.h>

 using namespace std;

 #define MP make_pair
#define PB push_back
typedef long long LL;
typedef pair<int,int> PII;
const double eps=1e-;
const double pi=acos(-1.0);
const int K=1e5+;
const int mod=1e9+; char ss[K],mx='a'-;
int ff;
int main(void)
{
cin>>ss;
for(int i=,len=strlen(ss);i<len;i++)
if(ss[i]<=mx)
;
else if(ss[i]==mx+)
mx++;
else
ff=;
if(ff)
printf("NO\n");
else
printf("YES\n");
return ;
}

最新文章

  1. iOS开发之Alamofire源码解析前奏--NSURLSession全家桶
  2. LVS负载平衡集群(没成型)
  3. AEAI BPM流程集成平台V3.0.2版本开源发布
  4. 后台API服务的设计考虑
  5. WCF并发控制与实例模式
  6. table动态添加删除一行和改变标题
  7. sql 表连接 join
  8. 闲置小U盘变身最强大路由器
  9. outlet删除不完全
  10. php函数声明的简单实例
  11. 零基Github Page个人博客建立教程无限的自由流动
  12. WAMPServer多站点配置方法
  13. python网络爬虫与信息提取 学习笔记day2
  14. objective-c随机数+日期格式显示一例
  15. BZOJ_1085_[SCOI2005]骑士精神_IDDFS
  16. HelloPython
  17. 读《Tooth-Marked Tongue Recgnition Using Multiple Instance Learning and CNN Features》
  18. Linux 常用命令笔记-2
  19. LeetCode算法题-Implement Queue Using Stacks(Java实现)
  20. [NOI2017]游戏(2-SAT)

热门文章

  1. 【Raspberry pi】python ide-spyder
  2. Page_ClientValidate 用法
  3. JAVA“找不到或无法加载主类” 问题的解决办法
  4. iOS 开发之--打测试包的时候报错的解决方法
  5. MVC、MVP、MVVM
  6. hdu3729(二分图)
  7. db2 相关命令
  8. fis3 静态文件 发布 线上
  9. lookcss在深夜23:32开通
  10. 170227、java分布式系统开关功能设计(服务升降级)