URAL 1496. Spammer

11 篇文章 0 订阅

1496. Spammer

Time limit: 1.0 second
Memory limit: 64 MB
There is a famous spammer among our friends. In the end of every contest he is submitting his incorrect solutions at the speed of a machine-gun. In addition, he cheats by means of using several accounts for debugging. The judges eventually decided to disqualify the spammer. For that, they first want to discover all of his debugging accounts. The judges know which teams submitted their solutions in the last ten minutes of a contest. They regard as the spammer's debugging accounts all accounts which submitted solutions at least twice during the last ten minutes of the contest. Your task is to find these accounts.

Input

The first line contains the number  N of submissions in the last 10 minutes (0 ≤  N ≤ 100). The next N lines contain the names of teams which submitted their solutions in this period. The names contain only digits and lowercase English letters. Each name is not longer than 30 symbols.

Output

Output in an arbitrary order all accounts which, in the judges' opinion, are used by the spammer.

Sample

input output
11
naucoder
iceman
abikbaev
abikbaev
petr
abikbaev
abikbaev
x
abikbaev
acrush
x
x
abikbaev




题意:输出出现过不少于两次的字符串。

解析:map直接搞。




AC代码:

#include <cstdio>
#include <map>
#include <string>
#include <iostream>
using namespace std;

map<string, int> a;

int main(){
    #ifdef sxk
        freopen("in.txt", "r", stdin);
    #endif //sxk

    int n;
    string s;
    while(scanf("%d", &n)==1){
        while(n--){
            cin>>s;
            a[s] ++;
        }
        map<string, int>::iterator it;
        for(it = a.begin(); it !=a.end(); it ++){
            if(it->second >= 2) cout<<it->first<<endl;
        }
    }
    return 0;
}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值