Code obfuscation
来源:互联网 发布:淘宝服务市场怎么投诉 编辑:程序博客网 时间:2024/05/21 18:03
Question
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”.
Example
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.
代码
#include <stdio.h>#include <string.h>int main(){ char a[505]; int i,j,n,t='a';//t从a开始,之后每次向后t所存储的ASCII码加1. scanf("%s",&a); n=strlen(a); if(a[0]!='a')//对第一个字母为b时进行判断,排除这种情况的干扰。 { printf("NO\n"); return 0; } for(i=0;i<n;i++) { if(a[i]==t+1) t++;//下一个字母。 else if(a[i]>t+1) { printf("NO\n"); return 0; } } printf("YES\n"); return 0;}
- Code obfuscation
- PLSQL Source Code Obfuscation
- cf397 B. Code obfuscation
- DCO ( Dynamic Code Obfuscation )理解
- 【codeforces 765B】Code obfuscation
- CF 397 B. Code obfuscation
- Protect Python Code with Bytecode Obfuscation
- Int 2Dh debugger detection and code obfuscation
- Int 2Dh debugger detection and code obfuscation
- Codeforces Round #397(Div. 1 + Div. 2 combined)B. Code obfuscation【水题】
- 术语:Obfuscation
- Java ME Obfuscation 使用
- hdu 2340 Obfuscation
- POJ 3504 Obfuscation 笔记
- HDU 2340 Obfuscation 乱搞
- POJ 3504 Obfuscation 解题报告
- Obfuscation failed (result=1)
- 关于Obfuscation based on multilinear map学习
- 多态&多态对象模型
- XML解析之XPath解析
- HDU-6035 Colorful Tree(dfs序造树)
- 获取HiveConnection,及重现获取过程中的某些问题。
- ios tableView加载cell时有延时的操作 比如反地理编码
- Code obfuscation
- Const类
- RecyclerView的滑动到指定位置
- 找出数组出现次数超过一半的数
- Android开发——贝塞尔曲线解析
- Android应用防止模拟点击,防范抢红包类似插件的方法
- 智能家居2.0:智能音箱何以成为新的入口
- mybatis入门基础(六)----高级映射(一对一,一对多,多对多)
- Android进阶之路