#include <bits/stdc++.h>
using namespace std;
bool check(char c)//检查是否为字母或数字
{
if(c>='A'&&c<='Z'||c>='a'&&c<='z'||c>='0'&&c<='9')
return true;
else
return false;
}
int main()
{
map<string,int> count;
string str;
getline(cin,str);
int i = 0;
while(i<str.length())
{
string word;
while(i<str.length()&&check(str[i]))
{
if(str[i]>='A'&&str[i]<='Z'){ //大写统一改为小写
str[i] += ('a'-'A');
}
word += str[i]; //字符拼接 +
i++;
}
if(word != ""){
if(count.find(word)==count.end()) count[word]=1; //这单词还没出现过,计数为1
else count[word]++;
}
while(i<str.length()&&!check(str[i])) //遇到其它字符跳过
{
i++;
}
}
string ans;
int MAX=0;
for(map<string,int>::iterator it=count.begin();it != count.end();it++) //只能用!=,而不能用<end()
{
if(it->second>MAX)
{
ans = it->first;
MAX = it->second;
}
}
cout<<ans<<" "<<MAX<<endl;
return 0; }

  

最新文章

  1. 深入理解JVM内幕(转)
  2. php变量 写时改变 写时复制
  3. Train Problem I hdu 1022(栈)
  4. js 调整排序
  5. C++学习20 虚基类详解
  6. IOS AutoLayout 文章
  7. Sublime Text 2 插件
  8. python手记(30)
  9. 适应手机端的jQuery图片滑块动画
  10. UVA 12113 Overlapping Squares
  11. JavaScipt中对DOM的理解
  12. python+requests+unittest API接口测试
  13. Cypher语法
  14. [BZOJ 3329]Xorequ
  15. ubuntu下安装php扩展
  16. mysql 通过查看mysql 配置参数、状态来优化你的mysql
  17. axios的学习与使用
  18. inno setup 软件打包
  19. reduce 之 mixin实现
  20. js阻止默认事件、拖拽等等

热门文章

  1. 从零开始学习 asp.net core 2.1 web api 后端api基础框架(四)-创建Controller
  2. 安装在谷歌axure小工具
  3. spring boot 集成mybatis报错Missing artifact
  4. wpf采用Xps实现文档显示、套打功能
  5. WPF学习笔记:(一)数据绑定与DataContext
  6. Bootstrap 反色导航条
  7. VisualSVN-6.0.1Patch just for VS2017补丁原创发布
  8. Qt侠:像写诗一样写代码,玩游戏一样的开心心情,还能领工资!
  9. SQLServer 复制中移除和添加发布而不初始化所有项目
  10. c#实现golang 的channel