1071. Speech Patterns (25)
来源:互联网 发布:新网域名转出流程 编辑:程序博客网 时间:2024/06/14 12:01
题目:https://www.patest.cn/contests/pat-a-practise/1071
代码:
#include<cstdio> #include<cstring> #include<cstdlib> #include<cmath>#include<map>#include<string>#include<iostream>#include<algorithm> using namespace std; bool check(char c){ if(c>='0'&&c<='9')return true; if(c>='a'&&c<='z')return true; if(c>='A'&&c<='Z')return true; return false;}int main() { map<string,int>s;string str;getline(cin,str);int i=0;while(i<str.length()){string temp;while(i<str.length()&&check(str[i])==true){if(str[i]>='A'&&str[i]<='Z'){ str[i]+=32;}temp+=str[i];i++;}if(temp!=" "){if(s.find(temp)==s.end()) s[temp]=1;else s[temp]++;}while(i<str.length()&&check(str[i])==false){ i++;}}string final;int max=0;for(map<string,int>::iterator i=s.begin();i!=s.end();i++){if(i->second>max){max=i->second;final=i->first;}}cout<<final<<" "<<max<<endl; system("pause"); }
0 0
- 1071. Speech Patterns (25)
- 1071. Speech Patterns (25)
- 1071. Speech Patterns (25)
- 1071. Speech Patterns (25)
- 1071. Speech Patterns (25)
- 1071. Speech Patterns (25)
- 1071. Speech Patterns (25)
- 1071. Speech Patterns (25)
- 1071. Speech Patterns (25)
- 1071. Speech Patterns (25)
- 1071. Speech Patterns (25)
- 1071. Speech Patterns (25)
- 1071. Speech Patterns (25)
- 1071. Speech Patterns (25)
- 1071. Speech Patterns (25)
- 1071. Speech Patterns (25)
- 1071. Speech Patterns (25)
- 1071. Speech Patterns (25)
- lua实现更新服务器
- Linux Sed 用法
- iOS setValue和setObject的区别
- unicode与utf-8
- apache服务出现Forbidden 403问题的解决方法总结
- 1071. Speech Patterns (25)
- 机器学习系列:(三)特征提取与处理
- Android源码开发之添加/删除系统应用
- ubuntu 下安装hadoop 2.7.3安装
- IOS10 Notification远程推送通知(三)
- js判断特殊字符
- [session] -- 将session写到数据库或缓存上
- studio的快捷键(收集中)
- Oracle约束(上)