Contest1389 - 2018年第三阶段个人训练赛第四场.Not Found(水题)

.

问题 A: Not Found

时间限制: 1 Sec  内存限制: 128 MB
提交: 463  解决: 178
[提交] [状态] [讨论版] [命题人:admin]

题目描述

You are given a string S consisting of lowercase English letters. Find the lexicographically (alphabetically) smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print None instead.

Constraints
1≤|S|≤105 (|S| is the length of string S.)
S consists of lowercase English letters.

输入

Input is given from Standard Input in the following format:
S

输出

Print the lexicographically smallest lowercase English letter that does not occur in S. If every lowercase English letter occurs in S, print None instead.

样例输入

atcoderregularcontest

样例输出

b

提示

The string atcoderregularcontest contains a, but does not contain b.

#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main()
{
    int n,m;
    string s;
    while(cin>>s){
        int fuck[100];
        memset(fuck, 0, sizeof(fuck));
        for(int i=0; i<s.size(); i++) fuck[s[i]-'a'] = 1;
        int k;
        for(k=0; k<26; k++)  if(!fuck[k])  break;
        if(k == 26) printf("None\n");
        else printf("%c\n", k+'a');
    }
}

猜你喜欢

转载自blog.csdn.net/XxxxxM1/article/details/81190413