CF765B.Code obfuscation
普及-
通过率:0%
时间限制:2.00s
内存限制:512MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.
科斯佳非常喜欢 Codeforces 的比赛。然而,他非常失望,因为自己的代码经常被他人成功 hack。因此,他决定在即将到来的比赛前对自己的代码进行混淆(即故意使其更难读懂)。
为了混淆代码,科斯佳首先查看程序中第一个出现的变量名,并将该变量名的所有出现位置替换为单个符号 _a_;接着,他查看尚未被替换的第二个变量名,并将它的所有出现位置替换为 _b_;依此类推。科斯佳很有礼貌,因此在混淆之前,他从不使用任何单字母变量名。此外,他的程序中至多包含 26 个不同的标识符。
现给你一段程序的标识符列表(其中空格与换行符已被移除)。请判断该程序是否可能是科斯佳混淆操作后得到的结果。
输入格式
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.
输入仅有一行,包含一个由小写英文字母组成的字符串 S(1 ≤ ∣S∣ ≤ 500)——即程序中去除所有空白字符后的标识符序列。
输出格式
If this program can be a result of Kostya's obfuscation, print "YES" (without quotes), otherwise print "NO".
如果该程序可能是科斯佳混淆后的结果,则输出 “YES”(不带引号),否则输出 “NO”。
输入输出样例
输入#1
abacaba
输出#1
YES
输入#2
jinotega
输出#2
NO
说明/提示
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.
在第一个样例中,一种可能的标识符列表为 “number string number character number string number”。科斯佳将按如下方式混淆该程序:
- 将所有
number替换为a,结果为"a string a character a string a"; - 将所有
string替换为b,结果为"a b a character a b a"; - 将所有
character替换为c,结果为"a b a c a b a"; - 所有标识符均已替换完毕,因此混淆过程结束。
输入解题思路,AI测评打分。不知道怎么写?