当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2934:Automatic Correction of Misspellings

题目描述

Some text editors offer a feature to correct words which seem to be written incorrectly. In this problem you are asked to implement a simple Automatic Correction of Misspellings (ACM).

ACM takes care of the following misspellings of words:

  1. One letter is missing (e.g., letter is written leter) or too much (e.g., letter is written lettter).
  2. One letter is wrong (e.g., letter is written ketter)
  3. The order of two adjacent letters is wrong (e.g., letter is written lettre)

ACM is based on a dictionary of known words. When a text contains a word which is not in the dictionary, ACM will try to replace it by a similar word of the dictionary. Two words are similar if we can transform one word into the other by doing exactly one of the misspellings listed above. An unknown word is left unchanged if there is no similar word in the dictionary.

输入解释

The first line of the input file will give the number n of words in the dictionary (n ≤ 10000). The next n lines contain the dictionary words. The following line contains an integer q ≤ 1000, the number of query words. The next q lines contain the query words. You may assume that each word in the input consists of 1 to 25 lower case letters (‘a’ to ‘z’).

输出解释

For each query word, print one line with the query word followed by one of the following possibilities:

  1. is correct, if the word occurs in the dictionary.
  2. is a misspelling of <x>, where <x> is a word of the dictionary similar to the query word, and the query word is not in the dictionary. In the case that there are several possibilities, select the word from the dictionary which appeared earlier in the input.
  3. is unknown, if cases 1 and 2 do not apply.
输入样例
10
this
is
a
dictionary
that
we
will
use
for
us
6
su
as
the
dictonary
us
willl
输出样例
su is a misspelling of us
as is a misspelling of is
the is unknown
dictonary is a misspelling of dictionary
us is correct
willl is a misspelling of will

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Ulm Local 2006

源链接: POJ-2934

最后修改于 2020-10-29T06:47:57+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536