URAL 1496. Spammer

Source: Internet
Author: User
Tags time limit

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 was submitting his incorrect solutions at the speed of a machine-gun. In addition, the He cheats by means of the using several accounts for debugging. The judges eventually decided to disqualify the spammer. For this, 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.InputThe first line contains the number N of submissions in the last ten 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 中文版 letters. Each name was not longer than symbols.OutputOutput in a arbitrary order all accounts which, in the judges ' opinion, is used by the spammer.Sample

input Output
Naucoder
iceman
Abikbaev
Abikbaev
Petr
Abikbaev
Abikbaev
x
Abikbaev
Acrush
X
X
Abikbaev




Test instructions: The output has a string of not less than two occurrences.

Parse: Map directly to engage.




AC Code:

#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;
}



Related Keywords:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.