原题链接(洛谷):https://www.luogu.com.cn/problem/P3880
题解(C++):
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 55;
string s, s3;
bool o = false;
int n = 0, a[N];
signed main() {
getline(cin, s);//整行读入
for (int i = 0; i < s.size(); i++) {//输出第一个提示
if (isalpha(s[i]))a[i] = ++n, cout << ".";
else cout << s[i];
}
cout << endl;
for (int i = 0; i < s.size(); i++){
if (isalpha(s[i]) && a[i] > (n + 1) / 3) {
cout << ".";
if (s[i] == 'A' || s[i] == 'E' || s[i] == 'I' || s[i] == 'O' || s[i] == 'U' ||
s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u')
o = true, s3 += s[i];
else s3 += ".";
} else cout << s[i], s3 += s[i];
}
cout << endl;
if (o) return cout<< s3 << endl, 0;
for (int i = 0; i < s.size(); i++) {
if (isalpha(s[i]) && a[i] > (2 * n + 1) / 3)
cout << ".";
else cout << s[i];
}
}
没有回复内容