UVa 755/POJ 1002 487--3279 (sort)

Source: Internet
Author: User
Tags sort time limit

755-487--3279

Time limit:3.000 seconds

Http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=98&page=show_problem &problem=696

http://poj.org/problem?id=1002

Businesses like to have memorable telephone numbers. One way to make a telephone number memorable are to have it spell a memorable word or phrase. For example, your can call the University of Waterloo by dialing the memorable tut-glop. Sometimes only the # is used to spell a word. When you are back to your hotel tonight your can order a pizza from Gino's by dialing 310-gino. Another Way to make a telephone number memorable are to group the digits in a memorable way. You could the order your pizza from pizza Hut by calling their ' three ' "number tens. The standard form of a telephone number is seven decimal digits with a hyphen between the third and fourth digits (e.g. 88 8-1200). The keypad of a phone supplies the mapping of letters to numbers, as Follows:a, B, and C map to 2

D, E, and F map to 3

G, H, and I map to 4

J, K, and L map to 5

M, N, and O map to 6

P, R, and S map to 7

T, U, and V map to 8

W, X, and Y map to 9

There is no mapping for Q or Z. Hyphens are not dialed, and can be added and removed as necessary. The standard form of Tut-glop is 888-4567, the standard form of 310-gino is 310-4466, and the standard form of 3-10-10-10 Is 310-1010. Two telephone numbers are equivalent if they have the same form. (They dial the same number.) Your are compiling a directory of telephone numbers from local businesses. As part of the quality control process your want to check this no two (or more) businesses in the directory have the same t Elephone number.

Input

The ' The ' input contains the number of datasets in the input. A blank line follows. The ' a ' of each dataset specifies the number of telephone numbers in the directory (up to 100,000) as a positive in Teger alone on the line. The remaining lines list, the telephone numbers in the directory, is with each number alone on a line. Each telephone number consists of a string composed of decimal digits, uppercase letters (excluding Q and Z) and hyphens. Exactly seven of the characters in the string would be digits or letters. There ' s a blank line between datasets.

Output

Generate a line of output for each telephone number, that appears the more than once into any form. The line should give the "telephone number in standard form", followed by a spaces, followed by the number of times the TELEP Hone number appears in the directory. Arrange the output lines by telephone number in ascending lexicographical order. If There are no duplicates in the input print:

No duplicates.

Print a blank line between datasets.

Sample Input

1
4873279
its-easy
888-4567
3-10-10-10
888-glop
tut-glop 967-11-11
310-gino
F101010
888-1200
-4-8-7-3-2-7-9-
487-3279

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.