首页 > 其他 > 详细

含e最多的单词

时间:2021-07-10 22:14:18      阅读:42      评论:0      收藏:0      [点我收藏+]


#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
int ce(string str)
{
    int count = 0;
    for (int i = 0; i < str.length(); i++)
    {
        if (str[i] == ‘e‘)
            count++;
    }
    //cout << count << endl;计算e的个数
    return count;
}
int main()
{
    int maxe = 0;
    string maxstr;
    string str;
    cin >> str;
    string ss[25];
    int s = 0;
    while (str != "#")
    {
        if (ce(str) > maxe)
        {
            maxe=ce(str);
            s = 0;
            ss[s++] = str;
            //cout<<"new"<<endl;
        }
        else if (ce(str) == maxe)
        {
            ss[s++] = str;ji
            
            //cout<<‘=‘<<endl;
        }
        cin >> str;
    }
    for (int i = 0; i < s; i++)
        cout << ss[i] << endl;
    return 0;
}

含e最多的单词

原文:https://www.cnblogs.com/kubopiy/p/14994886.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!