L1-070 吃火锅 (15 分)

水题~,直接库函数解决。

int n,m;

int main()
{
    string line;
    string s="chi1 huo3 guo1";
    int tot=0,cnt=0,ans=0;
    while(getline(cin,line))
    {
        if(line == ".") break;
        tot++;

        if(line.find(s) != -1)
        {
            if(ans == 0) ans=tot;
            cnt++;
        }
    }

    cout<<tot<<endl;
    if(cnt == 0) puts("-_-#");
    else cout<<ans<<' '<<cnt<<endl;
    //system("pause");
    return 0;
}
posted @ 2021-04-21 11:29  Dazzling!  阅读(398)  评论(0编辑  收藏  举报