Codeforces Round #293 (Div. 2) 总结
来源:互联网 发布:软件培训师收入 编辑:程序博客网 时间:2024/06/05 15:18
Vitaly is a diligent student who never missed a lesson in his five years of studying in the university. He always does his homework on time and passes his exams in time.
During the last lesson the teacher has provided two strings s and t to Vitaly. The strings have the same length, they consist of lowercase English letters, string s is lexicographically smaller than string t. Vitaly wondered if there is such string that is lexicographically larger than string s and at the same is lexicographically smaller than string t. This string should also consist of lowercase English letters and have the length equal to the lengths of strings s and t.
Let's help Vitaly solve this easy problem!
The first line contains string s (1 ≤ |s| ≤ 100), consisting of lowercase English letters. Here, |s| denotes the length of the string.
The second line contains string t (|t| = |s|), consisting of lowercase English letters.
It is guaranteed that the lengths of strings s and t are the same and string s is lexicographically less than string t.
If the string that meets the given requirements doesn't exist, print a single string "No such string" (without the quotes).
If such string exists, print it. If there are multiple valid strings, you may print any of them.
ac
b
aaazzz
kkk
abcdefgabcdefh
No such string
String s = s1s2... sn is said to be lexicographically smaller than t = t1t2... tn, if there exists such i, thats1 = t1, s2 = t2, ... si - 1 = ti - 1, si < ti.
解:给你两个字符串a,b,然后让你输出一个字符串,这个字符串c要求满足 a<c<b。
#include<stdio.h>#include<string.h>#include<string>#include<iostream>#include<algorithm>using namespace std;const int maxm=1e2+10;string a,b;int main(){ //freopen("standard input","w",stdin); // freopen("standard output","r",stdout); while(cin>>a>>b) { int ok=1; a[a.length()-1]++; for(int i=a.length()-1;i>=0;i--) { if(a[i]>'z') { a[i]='a'; a[i-1]++; } } if(a==b) { cout<<"No such string"<<endl; } else { cout<<a<<endl; } } return 0;}
- Codeforces Round #293 (Div. 2) 总结
- Codeforces Round #293 (Div. 2)
- Codeforces Round #293 (Div. 2)
- Codeforces Round #293 (Div. 2)
- Codeforces Round #293 (Div. 2)
- Codeforces Round #293 (Div. 2)
- Codeforces Round #161 (Div. 2)总结
- Codeforces Round #162 (Div. 2)总结
- Codeforces Round #170 (Div. 2)总结
- Codeforces Round #171 (Div. 2)总结
- Codeforces Round #172 (Div. 2)总结
- Codeforces Round #173 (Div. 2)总结
- Codeforces Round #176 (Div. 2)总结
- Codeforces Round #185 (Div. 2) 总结
- Codeforces Round #187 (Div. 2) 总结
- Codeforces Round #190 (Div. 2) 总结
- Codeforces Round #193 (Div. 2)总结
- Codeforces Round #194 (Div. 2)总结
- windows转化python为可执行程序py2exe使用方法
- 程序报0xc0150002和0xc000007b错误的解决方法
- JAVA中的多线程操作:线程等待、阻塞、让步
- 查看grid正常集群状态 crs_stat -t
- hdu 5366(排列组合)
- Codeforces Round #293 (Div. 2) 总结
- JVM 参数配置及详解 -Xms -Xmx -Xmn -Xss 调优总结
- Myisam与Innodb的选择
- Linux——Linux默认权限、特殊权限
- Mac下添加java环境变量
- proxool学习
- 欢迎使用CSDN-markdown编辑器
- vim替换操作整理大全
- Servlet生命周期