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


相关推荐

  • PyCharm切换Python版本

    PyCharm切换Python版本

    2021年10月22日
    44
  • 四、单例模式—不要冒充我,我只有一个! #和设计模式一起旅行#

    单例模式—不要冒充我! 我就是我 是颜色不一样的烟火 天空开阔 要做最坚强的泡沫。——《我就是我》-张国荣有人冒充我给大家说一个秘密了,其实我和设计模式本来并不认识,是相识于网络上,我们聊的很多,聊人生聊梦想,有一天我突然说,设计模式我们一起去旅行吧,她说可以啊!所以才有着一次的旅行。但是总有一些人想要冒充我,因为他们看到了我和设计模式的这场旅行,那么怎么保证“设计…

    2022年2月27日
    49
  • c中给字符数组,字符串指针赋值的方法总结[通俗易懂]

    在写程序的时候,总是搞混,现在总结一下以免以后再犯chara[10];怎么给这个数组赋值呢?谭浩强的书上明确指出,字符数组可以在定义时整体赋值,不能再赋值语句中整体赋值。1、定义的时候直接用字符串赋值chara[10]=”hello”;注意:不能先定义再给它赋值,如chara[10];a[10]=”hello”;这样是错误的!2、对数组中字符逐个赋值chara

    2022年4月15日
    51
  • pycharm自动补全提示选项前面的小标代表含义

    pycharm自动补全提示选项前面的小标代表含义c classf functionm methodv variablep parameter

    2025年8月23日
    2
  • LVM扩容操作

    LVM扩容操作文章目录一、测试环境二、给lvm分区扩容(加硬盘)1.新增硬盘2.给新的硬盘分区3、Lvm操作查看卷组状态:`vgdisplay`创建物理卷:`pvcreate/dev/sdb1`扩展卷组:`vgextend卷组名物理卷路径`扩展逻辑卷:lvextend拉伸文件系统:xfs_growfs或者resize2fs4、验证结果:参考文档一、测试环境我是在virtualbox上安装的测试环境:centos。其具体硬盘配置如下df-Th磁盘情况:fdisk-l今天主要是分别操作下

    2022年6月20日
    38
  • Java对象转换Map(工具类)[通俗易懂]

    Java对象转换Map(工具类)[通俗易懂]/***@Description//TODOMap工具类*@Date2020/5/79:54*@Authorhuangwb**/publicclassMapUtils{/***@returnvoid*@Authorhuangwb*@Description//TODO对象转换成map*…

    2022年6月8日
    41

发表回复

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

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