CF278B.New Problem

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Coming up with a new problem isn't as easy as many people think. Sometimes it is hard enough to name it. We'll consider a title original if it doesn't occur as a substring in any titles of recent Codeforces problems.

You've got the titles of nn last problems — the strings, consisting of lowercase English letters. Your task is to find the shortest original title for the new problem. If there are multiple such titles, choose the lexicographically minimum one. Note, that title of the problem can't be an empty string.

A substring s[l... r]s[l...\ r] (1<=l<=r<=s)(1<=l<=r<=|s|) of string s=s1s2... sss=s_{1}s_{2}...\ s_{|s|} (where s|s| is the length of string ss ) is string slsl+1... srs_{l}s_{l+1}...\ s_{r} .

String x=x1x2... xpx=x_{1}x_{2}...\ x_{p} is lexicographically smaller than string y=y1y2... yqy=y_{1}y_{2}...\ y_{q} , if either p<q and x1=y1,x2=y2,... ,xp=ypx_{1}=y_{1},x_{2}=y_{2},...\ ,x_{p}=y_{p} , or there exists such number rr (r<p,r<q) , that x1=y1,x2=y2,... ,xr=yrx_{1}=y_{1},x_{2}=y_{2},...\ ,x_{r}=y_{r} and x_{r+1}<y_{r+1} . The string characters are compared by their ASCII codes.

输入格式

The first line contains integer nn ( 1<=n<=301<=n<=30 ) — the number of titles you've got to consider. Then follow nn problem titles, one per line. Each title only consists of lowercase English letters (specifically, it doesn't contain any spaces) and has the length from 1 to 20, inclusive.

输出格式

Print a string, consisting of lowercase English letters — the lexicographically minimum shortest original title.

输入输出样例

  • 输入#1

    5
    threehorses
    goodsubstrings
    secret
    primematrix
    beautifulyear
    

    输出#1

    j
    
  • 输入#2

    4
    aa
    bdefghijklmn
    opqrstuvwxyz
    c
    

    输出#2

    ab
    

说明/提示

In the first sample the first 9 letters of the English alphabet (a, b, c, d, e, f, g, h, i) occur in the problem titles, so the answer is letter j.

In the second sample the titles contain 26 English letters, so the shortest original title cannot have length 1. Title aa occurs as a substring in the first title.

首页