Microsoft Online Test for Core Technical Positions 4: Most Frequent Logs

Time Limit:10000ms
Case Time Limit:3000ms
Memory Limit:256MB

Description

In a running system, there are many logs produced within a short period of time, we’d like to know the count of the most frequent logs.

Logs are produced by a few non-empty format strings, the number of logs is N(1<=N<=20000), the maximum length of each log is 256.

Here we consider a log same with another when their edit distance (see note) is <= 5.

Also we have a) logs are all the same with each other produced by a certain format string b) format strings have edit distance  5 of each other.

Your program will be dealing with lots of logs, so please try to keep the time cost close to O(nl), where n is the number of logs, and l is the average log length.

Note edit distance is the minimum number of operations (insertdeletereplace a character) required to transform one string into the other, please refer to

http://en.wikipedia.orgwikiEdit_distance for more details.

Input

Multiple lines of non-empty strings.

Output

The count of the most frequent logs.

Sample Input
Sample Output
如果本文对您生活或工作产生了积极影响,那我非常高兴。
如果您愿意为文章的内容或想法提供支持,欢迎点击下边的捐赠按钮,资助作者创作更多高价值高品质的内容。
支付宝捐赠
anyShare分享到:

发表回复