XXX公司的入职试题(时间:两小时)

XXX公司的入职试题(时间:两小时)

Description

Businesses like to have memorable telephone numbers. One way to make a telephone number memorable is to have it spell a memorable word or phrase. For example, you can call the University of Waterloo by dialing the memorable TUT-GLOP. Sometimes only part of the number is used to spell a word. When you get back to your hotel tonight you can order a pizza from Gino’s by dialing 310-GINO. Another way to make a telephone number memorable is to group the digits in a memorable way. You could order your pizza from Pizza Hut by calling their “three tens” number 3-10-10-10. 

The standard form of a telephone number is seven decimal digits with a hyphen between the third and fourth digits (e.g. 888-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 standard form. (They dial the same number.) 

Your company is compiling a directory of telephone numbers from local businesses. As part of the quality control process you want to check that no two (or more) businesses in the directory have the same telephone number. 

Input

The input will consist of one case. The first line of the input specifies the number of telephone numbers in the directory (up to 100,000) as a positive integer alone on the line. The remaining lines list the telephone numbers in the directory, 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 will be digits or letters. 

Output

Generate a line of output for each telephone number that appears more than once in any form. The line should give the telephone number in standard form, followed by a space, followed by the number of times the telephone 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 the line: 

No duplicates. 

Sample Input

12
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

Sample Output

310-1010 2
487-3279 4
888-4567 3

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/100509.html原文链接:https://javaforall.net

(0)
上一篇 2021年5月7日 下午5:00
下一篇 2021年5月7日 下午8:00


相关推荐

  • LaTeX 数学公式大全!

    LaTeX 数学公式大全!LaTeX数学公式大全!这里是来自一篇教程的截图,很全面。

    2022年6月24日
    27
  • (2019)OCP 12c 062考试题库出现大量新题-4

    (2019)OCP 12c 062考试题库出现大量新题-4

    2021年7月5日
    90
  • 如何解决Xcode中的SIGABRT错误

    一分钟,您的iOS应用程序可以在Xcode中正常运行,而下一分钟,它由于不可思议的SIGABRT错误而崩溃了。这是怎么回事!?在本教程中,您将学习:如何解决Xcode中的“SignalSIGABRT”错误 如何在Xcode中使用某些调试工具 SIGABRT代表什么,其原因是什么 找到SIGABRT根本原因的3种方法准备好?我们走吧。“线程1:信号SIGABRT”是什么意思? 检查您的Outlets 检查堆栈跟踪 设置异常断点 进一步阅读“线程1:信号SIGABRT”是什..

    2022年4月17日
    56
  • python矩阵乘法运算

    python矩阵乘法运算假设存在一个 N 个节点的无向图 我们用表示从点 u 到点 v 有连边 否则

    2026年3月19日
    3
  • linux下安装opencv_linux下安装pycharm

    linux下安装opencv_linux下安装pycharm一、RabbitMQ介绍RabbitMQ是一个开源的AMQP实现,服务器端用Erlang语言编写,支持多种客户端,如:Python、Ruby、.NET、Java、JMS、C、PHP、ActionScript、XMPP、STOMP等,支持AJAX。用于在分布式系统中存储转发消息,在易用性、扩展性、高可用性等方面表现不俗。AMQP,即AdvancedMessageQ…

    2026年4月17日
    3
  • BroadcastReceiver详解以及应用[通俗易懂]

    使用Android手机的时候,我们的手机管家中经常会出现开机自启动某某app,那么对于这个某某APP来说,他是怎么知道系统什么时候开机的呢?还有,系统短信怎么知道收到了短信?以及屏幕点亮与关闭、应用卸载与安装等等。这就讲到了Android四大组件之一:BroadcastReceiver,翻译是广播接收者。意思就是接收广播用的。他可以接收到系统开机完成的广播,以及系统电量不足的广播,以及系统收到短信的

    2022年4月18日
    57

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号