代码如下:
#include<iostream>
#include<string>
#include<cctype>
using namespace std;
inline void geshi(string&);
inline bool exam(string&, string&);
int main() {
string word;
string article_temp;
int cnt = 0, first = 0;
char ch{};
getline(cin, word);
geshi(word);
do {
cin >> article_temp;
ch = cin.get();
geshi(article_temp);
if (!exam(article_temp, word)) {
first++;
continue;
}
cnt++;
break;
} while (ch != '\n');
if (cnt != 0 && ch != '\n')
{
do {
cin >> article_temp;
ch = cin.get();
geshi(article_temp);
if (exam(article_temp, word))
cnt++;
}while (ch != '\n');
}
if (cnt != 0)
cout << cnt << " " << first;
else
cout << "-1";
}
inline void geshi(string& word) {
for (int i = 0; word[i]; i++)
if (isupper(word[i]))
word[i] = char(word[i] + 32);
}
inline bool exam(string& a, string& b) {
if (a == b) return 1;
return 0;
}