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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Pandas 创建DataFrame提示:type object ‘object‘ has no attribute ‘dtype‘

    Pandas 创建DataFrame提示:type object ‘object‘ has no attribute ‘dtype‘pandas版本0.25.3importpandasaspdsymbol_info_columns=[‘1′,’持仓方向’,’持仓量’,’持仓收益率’,’持仓收益’,’持仓均价’,’当前价格’,’最大杠杆’]#v3symbol_config={‘BTC’:’BTC-USDT-210924′,’LTC’:’LTC-USDT-210924′,’EOS’:’EOS-USDT-210924′,’ETH’:’ETH-USDT-210924′,’XRP’:’

    2022年5月11日
    110
  • UDP 流量攻击_网络流量攻击

    UDP 流量攻击_网络流量攻击最近在群里聊天看到有人被UDP攻击我几年前也遇到过当时前任工作交接过来面临很多挑战。话又说回来凡是跳槽或主动找到你的公司都是让你去救火的。先说说UDP攻击原理很简单就是随便连接一个IP地址随便写一个端口号。IP地址存在与否并不重要。这是UDP的特性。然后发送大数据包堵塞交换机路由器。我们在局域网上模拟注意UDP不能在同一个VLAN下…

    2022年9月27日
    4
  • 标志位「建议收藏」

    标志位「建议收藏」例二:例子

    2022年6月30日
    21
  • 优秀课件笔记旅游者行为Tourist BehaviorChapter Behavior「建议收藏」

    优秀课件笔记旅游者行为Tourist BehaviorChapter Behavior「建议收藏」第三章旅游者行为Chapter3TouristBehaviorChapterBehavior2006-12-5GeographyofTourism ……..2本章主要内容..旅游者((Definitionsoftourist)..旅游需求、旅游动机及旅游活动行为层次TheneedsforrecreationandtourismTouristmot

    2022年5月25日
    35
  • 另一个视角解读计算机编码-补码编码

    另一个视角解读计算机编码-补码编码

    2022年3月11日
    40
  • windows server 2008 r2 DNS服务器配置图文教程「建议收藏」

    windows server 2008 r2 DNS服务器配置图文教程「建议收藏」DNS服务器  DNS服务器用来负责将ip地址和域名进行互相解析。  DNS服务器的作用      简单来说,DNS服务器的作用就是帮助用户使用简单好记的域名来访问网络上的主机和网络服务。  DNS服务器中的记录类型 A地址:用于为特定域名制定对应的IP地址。CNAME:用于为特定域名指定对应的的别名,用户可以通过别名访问这个域名,也可以为特定域名指定多个别名。MX:用于为…

    2022年6月3日
    40

发表回复

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

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