#include<cstdio>
#include<cstring>
#include<map>
#include<string>
#include<algorithm>
using namespace std; int T;
char s[+];
char r[+];
map<string,int>m;
struct dan
{
char s[+];
int num;
}d[+];
int sum;
int tot; bool cmp(const dan&a,const dan&b)
{
if(a.num==b.num) return strcmp(a.s,b.s)<;
return a.num>b.num;
} //转小写
void F()
{
for(int i=;s[i];i++)
if(s[i]>='A'&&s[i]<='Z')
s[i]=s[i]-'A'+'a';
} void work()
{
int len=strlen(s);
tot=;
for(int i=;i<=len;i++)
{
if(s[i]>='a'&&s[i]<='z') r[tot++]=s[i];
else
{
r[tot]='\0';
if(strlen(r)>) m[r]=-;
tot=;
}
}
} void work2()
{
int len=strlen(s);
tot=;
for(int i=;i<=len;i++)
{
if(s[i]>='a'&&s[i]<='z') r[tot++]=s[i];
else
{
r[tot]='\0';
if(strlen(r)>)
{
if(m[r]!=-)
{
if(m[r]==) strcpy(d[sum++].s,r);
m[r]++;
}
}
tot=;
}
}
} int main()
{
scanf("%d",&T);
while(T--)
{
int flag=;
m.clear();
sum=;
while()
{
scanf("%s",s);
if(strcmp(s,"<oldwords>")==) {flag=;continue;}
if(strcmp(s,"</oldwords>")==) {flag=;continue;}
if(strcmp(s,"<article>")==) {flag=;continue;}
if(strcmp(s,"</article>")==) break;
if(flag==)
{
F();
work();
}
if(flag==)
{
F();
work2();
}
}
for(int i=;i<sum;i++) d[i].num=m[d[i].s];
sort(d,d+sum,cmp); for(int i=;i<min(,sum);i++) printf("%s\n",d[i].s);
printf("\n");
}
return ;
}

计算机学院大学生程序设计竞赛(2015’12) 1008 Study Words的更多相关文章

  1. hdu 计算机学院大学生程序设计竞赛(2015’11)

    搬砖 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submissi ...

  2. 计算机学院大学生程序设计竞赛(2015’11)1005 ACM组队安排

    1005 ACM组队安排 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Pro ...

  3. 计算机学院大学生程序设计竞赛(2015’12)Study Words

    Study Words Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Tota ...

  4. 计算机学院大学生程序设计竞赛(2015’12)Polygon

    Polygon Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Su ...

  5. 计算机学院大学生程序设计竞赛(2015’12)The Country List

    The Country List Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  6. 计算机学院大学生程序设计竞赛(2015’12) 1009 The Magic Tower

    #include<cmath> #include<cstdio> #include<cstring> #include<algorithm> using ...

  7. 计算机学院大学生程序设计竞赛(2015’12) 1006 01 Matrix

    #include<stdio.h> #include<string.h> #include<iostream> #include<algorithm> ...

  8. 计算机学院大学生程序设计竞赛(2015’12) 1003 The collector’s puzzle

    #include<cstdio> #include<algorithm> using namespace std; using namespace std; +; int a[ ...

  9. 计算机学院大学生程序设计竞赛(2015’12) 1004 Happy Value

    #include<cstdio> #include<cstring> #include<cmath> #include<vector> #include ...

随机推荐

  1. CentOS 7 BIND 主从搭建

    主机 10.2.0.15 从机 10.2.0.14 1 主机配置$vim /etc/named.bodani.com.zones zone"bodani.com" IN { typ ...

  2. 新手安装Oracle后的一些问题

      1.安装数据库服务端后,桌面上有个 打开之后点击一些按钮会叫你登录,用户名是SYSTEM,密码是安装的时候设置的密码(我设置的密码是root). . 2.在操作系统"运行"上输 ...

  3. flowers

    问题大全 Do you like flowers?(Why?) What flowers do you like?(why?) What is your favorite flower? Are fl ...

  4. vs找不到svn源代码管理插件之我见

    使用svn要安装两个文件,一个客户端:TortoiseSVN-1.8.msi,一个插件:AnkhSvn-2.5.msi:两个都安装好之后,在vs的tool(工具)选项卡中,选择自定义,然后选择sour ...

  5. IOS传值之代理传值(一)

    1.使用代理delegate的方法 2.使用通知Notification的方法 3.KVO等方法 4.block传值 ~~~~~~~~~~~~~~~~ 1.使用代理delegate的方法 #impor ...

  6. idea编译器中maven项目获取路径的方法

    资源文件放在哪里? 上 图中的 resources 目录叫资源目录 (main下,与java如果没有请自行创建), 在项目编译后文件会被放到红色的 classes 目录下, 注意如果你的 resour ...

  7. OVS - commands

    journalctl -t ovs-vswitchd ovs-vsctl show ovs-ofctl show br0 set vlanid ovs-vsctl set port eth0 tag= ...

  8. Android中自定义veiw使用Java中的回调方法

    //------------------MainActivity----中---------------------------------- import android.os.Bundle;imp ...

  9. Mysql 自动备份脚本

    转自: Mysql 自动备份脚本2 - - ITeye技术网站http://kangh.iteye.com/blog/2309091 备份方案: 备份主机:192.168.10.11 数据库服务器:1 ...

  10. BD string 百度之星初赛的题目 数学

    http://acm.hdu.edu.cn/showproblem.php?pid=5694 可以说这道题目挺考验思维含量的吧 首先,这个和数位dp是差不多的方法,计算cal(l)-cal(l-1): ...