注意点
1.使用getline(cin,s) 读入一行string,以换行结束
2.string的find函数,查找不到返回s.npos
string s;
void solve()
{
int cnt = 0,pos = 0,sum = 0;
while(getline(cin,s))
{
if (s == ".") break;
++cnt;
if (s.find("chi1 huo3 guo1") != s.npos)
{
if (!pos) pos = cnt;
sum ++;
}
}
cout << cnt << endl;
if (!pos) cout << "-_-#" << endl;
else cout << pos << " " << sum << endl;
}