描述
You, as a member of a development team for a new spell checking program, are to write a module that will check the correctness of given words using a known dictionary of all correct words in all their forms.
If the word is absent in the dictionary then it can be replaced by correct words (from the dictionary) that can be obtained by one of the following operations:
?deleting of one letter from the word;
?replacing of one letter in the word with an arbitrary letter;
?inserting of one arbitrary letter into the word.
Your task is to write the program that will find all possible replacements from the dictionary for every given word.
输入
The first part of the input file contains all words from the dictionary. Each word occupies its own line. This part is finished by the single character '#' on a separate line. All words are different. There will be at most 10000 words in the dictionary.
The next part of the file contains all words that are to be checked. Each word occupies its own line. This part is also finished by the single character '#' on a separate line. There will be at most 50 words that are to be checked.
All words in the input file (words from the dictionary and words to be checked) consist only of small alphabetic characters and each one contains 15 characters at most.
输出
Write to the output file exactly one line for every checked word in the order of their appearance in the second part of the input file. If the word is correct (i.e. it exists in the dictionary) write the message: " is correct". If the word is not correct then
write this word first, then write the character ':' (colon), and after a single space write all its possible replacements, separated by spaces. The replacements should be written in the order of their appearance in the dictionary (in the first part of the
input file). If there are no replacements for this word then the line feed should immediately follow the colon.
样例输入
i
is
has
have
be
my
more
contest
me
too
if
award
#
me
aware
m
contest
hav
oo
or
i
fi
mre
#
样例输出
me is correct
aware: award
m: i my me
contest is correct
hav: has have
oo: too
or:
i is correct
fi: i
mre: more me
参考代码
分享到:
相关推荐
前端项目-jquery-spellchecker,一个轻量级jquery插件,可以检查表单域或DOM树中文本的拼写。
北大POJ1035-Spell checker 解题报告+AC代码
北大ACP-POJ 1035 - Spell checker 原比赛题目测试数据(问题G)
SpellChecker节点模块 , 或本地绑定,具体取决于您的平台。 Windows 7及更低版本以及Linux将依赖Hunspell。 正在安装 npm install spellchecker 使用 SpellChecker = require ' spellchecker ' SpellChecker....
var spellchecker = new $.SpellChecker('textarea', { lang: 'en', parser: 'text', webservice: { path: '../../webservices/php/SpellChecker.php', driver: 'pspell' }, suggestBox: { ...
npm install codemirror-spell-checker --save通过。 bower install codemirror-spell-checker --save通过 。 请注意,jsDelivr可能需要几天时间才能更新到最新版本。 < link rel =" stylesheet " href =" ...
python库。 资源全名:spellchecker-0.2.linux-x86_64.tar.gz
jar包,亲测可用
以下任何一项都应显示建议列表: <leader>aap当前段落的<leader>aap <leader>aw表示当前单词或使用安装:CocInstall coc-spell-checker 命令和配置支持的语言英文(美国) 英文(GB)-通过将"cSpell.language": "en...
python库,解压后可用。 资源全名:spellchecker_ml-0.1.4-py3.6.egg
10 Seattle, 10.1 Berlin, 10.1 Berlin Starter Edition & C++Builder 2007, 2009, 2010, XE, XE2, XE3, XE4, XE5, XE6, XE7, XE8, 10 Seattle, 10.1 Berlin Features Grid RichEditor TreeView Spell Check HTML ...
spellchecker-buildkite-plugin Buildkite插件“拼写检查器”,对构建中的特定文件执行拼写检查例子steps : - plugins : - spellchecker#main: files : *.md
Qt Creator 也具有拼写检查。前人栽树,后人乘凉。 Qt 5.12.0 测试通过,详见 http://blog.davidrobot.com/2019/02/qt-creator-spellchecker-plugin.html
Lucene SpellChecker for Lucene 3.0.2
Inkdrop的拼写检查器插件 它将以浅红色突出显示所有拼写...ipm install spell-checker 改变语言 您可以从以下语言中更改语言:首选项->插件->拼写检查器->设置->语言: 版本历史 请参阅以获取每个更新中的更改概述。
This document describes v1.002 of Pod::Spell::CommonMistakes - released November 04, 2014 as part of Pod-Spell-CommonMistakes. 概要 #!/usr/bin/perl use strict; use warnings; use Pod::Spell::...
主要是SpellChecker控件的用法总结
拼写检查程序hunspell 命令行实用程序的包装类。 对于 Ubuntu 安装包: sudo apt-get install hunspellsudo apt-get install myspell-ru用法示例: require 'SpellChecker.php'$ checker = new SpellChecker ();$ ...
简单拼写检查器 只需 fork 这个存储库并运行:node spellChecker.js。
sw-prog2-数字拼写检查器 数字拼写检查器的存档