https://www.luogu.com.cn/problem/UVA492
这个题目,这个代码不能过为什么?扔了样例和自测,都没错啊
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
bool pd(char c)
{
return (c == 'a' || c == 'A' || c == 'e' || c == 'E' || c == 'i' || c == 'I' || c == 'o' || c == 'O' || c == 'u' || c == 'U');
}
int main()
{
string s;
while(cin >> s)
{
bool f = false;
int len = s.length() - 1;
if(s[len] == '.') f = true;
if(pd(s[0]))
{
if(f)
{
cout << s.substr(0, len) << "ay.";
}
else
{
cout << s << "ay";
}
}
else
{
for(int i = 1; i <= (f ? len - 1 : len); i++)
{
cout << s[i];
}
cout << s.front() << "ay";
if(f)
{
cout << ".";
}
}
char b = getchar();
cout << b;
}
return 0;
}