hdu 4847 Wow! Such Doge!

本文介绍了一个简单的程序,用于从输入文本中快速识别并计数特定关键词(如'DOGE', 'doge'等),适用于需要频繁处理文本数据的应用场景。

果断的签到题,不过15m才A,有点慢了。。。

代码写的很直接了...


<span style="font-size:14px;">#include<stdio.h>
#include<string.h>
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
char str[1000000];
int main()
{
    //freopen("in.txt","r",stdin);
    string s;
    int ans=0;
    while(getline(cin,s))
    {

        for(int i=0;i<s.length();i++)
        {
            string str="";
            for(int j=i;j<i+4;j++)
                str+=s[j];
                if(str=="DOGE")
                ans++;
                else if(str=="doge")
                ans++;
                else if(str=="Doge")
                ans++;
                else if(str=="dOge")
                ans++;
                else if(str=="doGe")
                ans++;
                else if(str=="dogE")
                ans++;
                else if(str=="DOge")
                ans++;
                else if(str=="DoGe")
                ans++;
                else if(str=="DogE")
                ans++;
                else if(str=="doge")
                ans++;
                else if(str=="dOGe")
                ans++;
                else if(str=="dOgE")
                ans++;
                else if(str=="doGE")
                ans++;
                else if(str=="DOGe")
                ans++;
                else if(str=="DOgE")
                ans++;
                else if(str=="dOGE")
                ans++;

        }

    }
    printf("%d\n",ans);
    return 0;
}
</span>



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值