美文网首页
CodeFoeces-938A

CodeFoeces-938A

作者: ss5smi | 来源:发表于2018-02-22 18:03 被阅读0次

题目

原题链接:A. Word Correction

题意

给出一个字串s,若存在连续的元音字母,则删除后面的字母。输出处理后的s。

代码

#include<bits/stdc++.h>
using namespace std;
string s;
bool check(char t){
    if(t=='a' || t=='e' || t=='i' || t=='o' || t=='u' || t=='y') return 1;
    return 0;
}
int main() {
    int n;
    cin>>n>>s;
    for(int i=0;i<n;i++){
        if(!check(s[i])) printf("%c",s[i]);
        else{
            printf("%c",s[i]);
            while(check(s[i+1])) i++;
        }
    }
    return 0;
}

相关文章

  • CodeFoeces-938A

    题目 原题链接:A. Word Correction 题意 给出一个字串s,若存在连续的元音字母,则删除后面的字母...

网友评论

      本文标题:CodeFoeces-938A

      本文链接:https://www.haomeiwen.com/subject/ibnntftx.html