-->
当前位置:首页 > 题库

PROGRAMMING:Alphabet (Yuyao 2019 primary school)

Luz5年前 (2021-05-10)题库457
Little m is a parrot who has just begun to learn English letters. He tries to say the whole alphabet, from 'a' to 'Z'. But the progress of parrot learning is always so slow, often mistakes. Now the trainer thinks that he can use speech recognition to automatically recognize the letters that Xiao m says. And please write a program to judge how many letters Xiao m says right from the beginning (starting from the letter 'a'). The more right he says, the more rewards he will get!
The English alphabet that Xiao m learns is "abcdefghijklmnopqrstuvwxyz".
###Input format:
The input has only one line, a string representing the alphabet of little M. No more than 26 in length, consisting only of lowercase letters.
###Output format:
The output starts with the first letter, and small m says how many words are right in a row.
###Input sample 1:
```in
abctyf
```
###Output sample 1:
```out
three
```
[example explanation]
Little m is right about the first three letters of the alphabet, "ABC"
###Input sample 2:
```in
zyx
```
###Output sample 2:
```out
0
```
[example explanation]
Little m is right about the first three letters of the alphabet, "ABC"







answer:If there is no answer, please comment
#include
using namespace std;
int t;
int main() {
string s,s1;
cin>>s;
s1="abcdefghijklmnopqrstuvwxyz#";
for (int i=0; i<=26; i++)
if (s[i]!= s1[i])
{
t = i;
break;
}
cout<}