简单题。

#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. 如何更改mysql可执行路径及更改mysql数据库文件路径

    一.如何更改服务中MySQL的可执行文件路径: 解决方法:到注册表里HKEY_LOCAL_MECHINE---SYSTEM ---CurrentControlSet 更改查找一. MySQL项值,然后 ...

  2. POJ 1611 The Suspects(简单并查集)

    ( ̄▽ ̄)" #include<iostream> #include<cstdio> using namespace std; ]; void makeSet(int ...

  3. LeetCode OJ 202. Happy Number

    Write an algorithm to determine if a number is "happy". A happy number is a number defined ...

  4. nefu 197 关键字检索(kmp算法)

    Description 在信息检索系统中一个很重要的环节就是关键字符串的查找,从而很多对自己有用的信息.给你一个很长的一段文字, 和一个关键信息字符串,现在要你判断这段文字里面是否有关键字符串. In ...

  5. java FLOAT

    System.out.println(""+ 1/2); 得不到0.5,只能得到0. 要想打印出浮点数,必须除数和被除数至少有一个是浮点数,像这样: System.out.prin ...

  6. Ubuntu上安装mono

    How do I use badgerports? badgerports is an Ubuntu repository. In order to use it, you must add it t ...

  7. xib storyboard

    initWithNibName加载xib或者storyboard BLEViewController *controller = [[BLEViewController alloc] initWith ...

  8. vb6学习心路

    1.不能加载 'MSCOMCTL.OCX'--继续加载工程吗解决办法:新建一个VB工程,然后按CTRL + T,选中 “Microsoft Windows Common Controls 6.0” 然 ...

  9. Bookmark

    http://stackoverflow.com/https://www.baidu.com/?tn=06074089_27_pghttp://apistore.baidu.com/http://to ...

  10. ignite中的sql查询

    ignite中进行sql查询需要对要查询的cache和字段进行配置,可以在xml中配置,也可以在代码中配置或进行注解,我用的是xml配置: <!-- 配置cache --> <pro ...