Under construction

Still being built. Things may change

Duplicate SSN

Interview

Time limit1sMemory limit128 MB

Summary
Read a list of Social Security numbers until the sentinel 000-00-0000, then print every number that appears more than once in ascending order.
Level

Easy3 of 10

Topics
Hash map, Sorting, String, Implementation
Solved
No attempts yet

Problem

The U.S. Social Security Administration has made a serious mistake. While assigning new Social Security numbers (SSNs) to U.S. citizens, it accidentally issued some duplicate numbers. Fortunately, the mistake was caught early, and a list of all possible duplicates is available. The Social Security Administration must contact everyone who does not have a unique SSN. Your task is to read the list of Social Security numbers, find all the duplicates, and print those duplicates in ascending order.

Input

The input is a list of Social Security numbers, one per line. The input is terminated by the Social Security number 000-00-0000, which is not counted as a duplicate.

Output

Print every Social Security number that appears more than once in the input, in ascending order. Print one number per line, and print each duplicated number only once even if it appears several times.

Examples1

  1. Example 1

    Input
    555-44-6666
    111-99-4444
    012-00-1111
    888-98-9086
    555-44-6666
    234-54-3425
    012-00-1111
    555-44-6666
    000-00-0000
    
    Expected output
    012-00-1111
    555-44-6666