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

 

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

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

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • cglib实现动态代理_cglib和jdk动态代理

    cglib实现动态代理_cglib和jdk动态代理一、前言  说到动态代理,开发者们第一时间想到的就是JDK动态代理和cglib动态代理。了解Spring的同学应该知道,SpringAOP功能的底层实现,就是使用的这两种动态代理。两者区别JDK的动态代理机制只能代理实现了接口的类,而没有实现接口的类就不能实现JDK的动态代理;cglib动态代理是针对类来实现代理的,它的原理是对指定的目标类生成一个子类,并覆盖其中方法实现增强。使用cglib实现动态代理,完全不受代理类必须实现接口的限制。cglib底层采用ASM字节码生成框架,使用字节码技术生

    2022年10月20日
  • ResNet解析_restnet

    ResNet解析_restnetResNet在2015年被提出,在ImageNet比赛classification任务上获得第一名,因为它“简单与实用”并存,之后很多方法都建立在ResNet50或者ResNet101的基础上完成的,检测,分割,识别等领域都纷纷使用ResNet,Alphazero也使用了ResNet,所以可见ResNet确实很好用。下面我们从实用的角度去看看ResNet。1.ResNet意义随着…

  • 大数据资产管理实战

    大数据资产管理实战各位好,今天和大家分享“大数据资产管理实战”这个课题。本次分享包括大数据资产管理的概述、方法论和实施效果三个部分的内容。第一部分:大数据资产管理概述提到企业数字化转型,不得不提现在的一个主流观点:未来的企业必将成为数字化企业,每个公司都将会成为软件公司!未来企业增长和竞争的能力越来越取决于其数字化创新能力。为了应对企业数字化转型,企业IT架构采用分布式、微服务、移动化、大数据等技术来应对业务变化带…

  • webstrom2021激活码【在线注册码/序列号/破解码】

    webstrom2021激活码【在线注册码/序列号/破解码】,https://javaforall.cn/100143.html。详细ieda激活码不妨到全栈程序员必看教程网一起来了解一下吧!

  • java list 转json 字符串_Java之JSON字符串与List集合之间相互转换

    java list 转json 字符串_Java之JSON字符串与List集合之间相互转换packagecom.crt.service.atom;importjava.util.ArrayList;importjava.util.List;importcom.alibaba.fastjson.JSON;importcom.crt.model.coupon.CouponInputDTO;/***@ClassName:TestJsonToString*@date:2017…

    2022年10月18日
  • ArrayList中的toArray()[通俗易懂]

    ArrayList中的toArray()[通俗易懂]ArrayList的toArrayArrayList提供了一个将List转为数组的一个非常方便的方法toArray。toArray有两个重载的方法:1.list.toArray();2.list.toArray(T[] a);对于第一个重载方法,是将list直接转为Object[]数组;第二种方法是将list转化为你所需要类型的数组,当然我们用的时候会转化为

发表回复

您的电子邮箱地址不会被公开。

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