CF518A.Vitaly and Strings

普及/提高-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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!

维塔利是一名勤奋的学生,在大学五年的学习中从未缺过一节课。他总是按时完成作业,并且准时通过考试。

在最后一节课上,老师给了维塔利两个字符串 ss 和 tt。这两个字符串长度相同,均由小写英文字母组成,且字符串 ss 的字典序小于字符串 tt。维塔利想知道:是否存在一个字符串,它严格字典序大于 ss,同时又严格字典序小于 tt?该字符串也必须由小写英文字母组成,且长度与 ss 和 tt 相同。

让我们帮维塔利解决这个简单的问题吧!

输入格式

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.

第一行包含字符串 ss(1 ≤ ∣s∣ ≤ 1001 ≤ |s| ≤ 100),由小写英文字母组成。其中,∣s∣|s| 表示字符串的长度。

第二行包含字符串 tt(∣t∣ = ∣s∣|t| = |s|),由小写英文字母组成。

保证字符串 ss 和 tt 的长度相同,且字符串 ss 在字典序上小于字符串 tt。

输出格式

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.

如果不存在满足给定要求的字符串,则输出单个字符串 “No such string”(不带引号)。

如果存在这样的字符串,则输出该字符串。如果存在多个合法字符串,你可以输出其中任意一个。

输入输出样例

  • 输入#1

    a
    c

    输出#1

    b
  • 输入#2

    aaa
    zzz

    输出#2

    kkk
  • 输入#3

    abcdefg
    abcdefh

    输出#3

    No such string

说明/提示

String s = _s_1_s_2... s__n is said to be lexicographically smaller than t = _t_1_t_2... t__n, if there exists such i, that _s_1 = _t_1, _s_2 = _t_2, ... s__i - 1 = t__i - 1, s__i < t__i.

字符串 s=s1s2…sns = s_1s_2\ldots s_n 被称为字典序小于字符串 t=t1t2…tnt = t_1t_2\ldots t_n,当且仅当存在某个下标 ii,使得 s1=t1, s2=t2, …, si−1=ti−1, si<tis_1 = t_1,\ s_2 = t_2,\ \ldots,\ s_{i-1} = t_{i-1},\ s_i < t_i。

输入解题思路,AI测评打分。不知道怎么写?

首页