1 条题解

  • 0
    @ 2022-6-25 10:37:04

    Water题

    全部换成小写+去标点即可。

    #include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef map<string, ll>::iterator it;
    map<string, ll> s;
    ll n, k, ans;
    string x, str;
    string tolower(string x) {
    	string res;
    	for (int i = 0; i < x.size(); i ++)
    		if (islower(x[i]) || isupper(x[i])) 
    			res.push_back(tolower(x[i]));
    	return res;
    }
    int main() {
    	while (cin >> x)
    		s[tolower(x)] ++;
    	for (it i = s.begin(); i != s.end(); i ++)
    		if (i->second > ans) ans = i->second, str = i->first;
    	cout << str << ' ' << ans << '\n';
    	return 0;
    }
    
    • 1

    信息

    ID
    123
    时间
    1000ms
    内存
    256MiB
    难度
    7
    标签
    (无)
    递交数
    18
    已通过
    9
    上传者