简单题。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std; char s[+];
string ans[+];
int tot; bool g(char c)
{
if(c>='a'&&c<='z') return ;
if(c>=''&&c<='') return ;
if(c>='A'&&c<='Z') return ;
return ;
} int main()
{
gets(s);
for(int i=;s[i];i++)
if(s[i]>='A'&&s[i]<='Z') s[i]=s[i]-'A'+'a';
string f=""; tot=;
for(int i=;s[i];i++)
{
if(g(s[i])) f=f+s[i];
else
{
if(f=="") continue;
ans[tot++]=f;
f="";
}
}
if(f!="") ans[tot++]=f;
sort(ans,ans+tot);
int now=,pre=;
string out;
int num=; while()
{
if(ans[now]==ans[pre]) now++;
else
{
if(now-pre>num)
{
num=now-pre;
out=ans[pre];
}
pre=now;
}
if(pre==tot) break;
} cout<<out<<" "<<num<<endl;
return ;
}

PAT (Advanced Level) 1071. Speech Patterns (25)的更多相关文章

  1. 【PAT甲级】1071 Speech Patterns (25 分)(getline(cin,x))

    题意: 输入一行字符串,输出出现过次数最多的由字母和数字组成的字符串以及它出现的次数(对大小写不敏感,输出全部输出小写). AAAAAccepted code: #define HAVE_STRUCT ...

  2. PAT 甲级 1071 Speech Patterns (25 分)(map)

    1071 Speech Patterns (25 分)   People often have a preference among synonyms of the same word. For ex ...

  3. PAT Advanced 1071 Speech Patterns (25 分)

    People often have a preference among synonyms of the same word. For example, some may prefer "t ...

  4. PAT甲题题解-1071. Speech Patterns (25)-找出现最多的单词

    分割字符串的用法+map映射给出input中出现次数最多的单词,如果次数相同,给出按字典序最小的. 这里我用了自定义分隔符来读取字符串,方法如下: //按照定义的分隔符d来分割字符串,对str进行读取 ...

  5. 1071. Speech Patterns (25)

    People often have a preference among synonyms of the same word. For example, some may prefer "t ...

  6. 1071 Speech Patterns (25)(25 分)

    People often have a preference among synonyms of the same word. For example, some may prefer "t ...

  7. PAT (Advanced Level) 1114. Family Property (25)

    简单DFS. #include<cstdio> #include<cstring> #include<cmath> #include<vector> # ...

  8. PAT (Advanced Level) 1109. Group Photo (25)

    简单模拟. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #i ...

  9. PAT (Advanced Level) 1105. Spiral Matrix (25)

    简单模拟. #include<cstdio> #include<cstring> #include<cmath> #include<map> #incl ...

随机推荐

  1. Chapter 1 First Sight——33

    At that moment, the bell rang loudly, making me jump, and Edward Cullen was out of his seat. 在这个时候,铃 ...

  2. sublime 2

    just baidu sublime license and find a free one!

  3. 我的 Github 个人博客是怎样炼成的

    Joey's Blog 长大后才发现政府建造 GFW 真是太 TM 机智了,由于本人自制力较差,且不说 91porn, youporn 等两性知识网站的超强战斗力,单单一个Youtube就可以让我瞬间 ...

  4. ios中的关键词@property @synthesize

    @interface Person : NSObject{    int myNumber;} @property(nonatomic) int myNumber;//这个关键字是可以带套get 与s ...

  5. centos6.5中gitlab的搭建

    使用gitlab官网给的源码进行安装,步骤如下: Install a GitLab CE Omnibus package on CentOS 6 (and RedHat/Oracle/Scientif ...

  6. js截取文件名

    str = 'C:\fakepath\ll.doc'; str.substring(str.lastIndexOf("\\")+1,str.lastIndexOf(".& ...

  7. 详细的SQL中datediff用法

    DATEDIFF 函数 [日期和时间] 功能返回两个日期之间的间隔. 语法DATEDIFF ( date-part, date-expression-1, date-expression-2 ) da ...

  8. Hibernate 系列教程11-继承-Single Table策略

    Single Table策略 通过 discriminator鉴别器来区分是父类还是子类 Employee public class Employee { private Long id; priva ...

  9. MVVM的架构设计与团队协作 with StoryBoard

    今天写这篇博客是想达到抛砖引玉的作用,想与大家交流一下思想,相互学习,博文中有不足之处还望大家批评指正.本篇博客的内容沿袭以往博客的风格,也是以干货为主,偶尔扯扯咸蛋(哈哈~不好好工作又开始发表博客啦 ...

  10. 关于前台主键输入错误对后台hibernate方法的影响

    由于前台输入时开始不小心打错了主键为value=“${conf_id}”/ 导致后台得到的主键不是数字“1”而是“1/”所以到后台就算是进的updata方法结果运行的却是添加方法 原因可能是传入的对象 ...