青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

posts - 195,  comments - 30,  trackbacks - 0
Spell Checker
Status In/Out TIME Limit MEMORY Limit Submit Times Solved Users JUDGE TYPE
stdin/stdout 3s 8192K 135 46 Standard

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.

Input

This problem consists of several test cases, each of which is described below:

The first part of each test case 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 test case 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 (words from the dictionary and words to be checked) consist only of small alphabetic characters and each one contains 15 characters at most.

The first line of the input contains an integer N, which is the number of test cases in the input, followed by N test cases described above.

Output

For each test case, first write to the output 'Scenario #k:', where k is the number of test case of input. Then on the next line write to the output exactly one line for every checked word in the order of their appearance in the second part of the test case. If the word is correct (i.e. it exists in the dictionary) write the message: "<checked word> 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.

Print a blank line after each test case.

Sample Input

1
i
is
has
have
be
my
more
contest
me
too
if
award
#
me
aware
m
contest
hav
oo
or
i
fi
mre
#

Sample Output

Scenario #1:
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

啟發(fā):map用于查找字符串還是很爽的。
#include<iostream>
#include
<cstdlib>
#include
<map>
#include
<math.h>
#include
<string>
using namespace std;
map 
<string,int> ans;
bool solve(char *s,char *key)
{
    
int i=strlen(s);
    
int j=strlen(key);
    
int num=0;
    
if(abs(i-j)>1)
    
return false;
    
else
    {
        
if(i-j==1)//比字典中多一個(gè) 
        {
            
for(int k=0;k<j&&num<=2;k++)
            {
                
if(s[k+num]!=key[k])
                {
                    num
++;
                    k
--;
                }
            }
            
if(num<=1)
            
return true;
            
else
            
return false;
        }
        
if(j-i==1)//比字典中少一個(gè) 
        {
            
for(int k=0;k<i&&num<=2;k++)
            {
                
if(s[k]!=key[k+num])
                {
                    num
++;
                  k
--;
                } 
            }
            
if(num<=1)
            
return true;
            
else
            
return false;
        }
        
if(i==j)
        {
            
for(int k=0;k<i&&num<=2;k++)
            {
                
if(s[k]!=key[k])
                num
++;
            }
            
if(num==1)
            
return true;
            
else
            
return false;
        }
    }
}
  
int main()
  {
  freopen(
"s.txt","r",stdin);
  freopen(
"key.txt","w",stdout);
  
int num,casetime=0;
  
int i,j,k;
  cin
>>num;
  
char s[16];
  
char str[10000][16];
  
while(num--)
  {
        casetime
++;
        cout
<<"Scenario #"<<casetime<<":"<<endl;
        ans.clear();
        i
=0;
        
while(1)
        {
            scanf(
"%s",&str[i]);
            
if(str[i][0]=='#')
              
break;
            ans[str[i]]
=1;
            i
++;
        }
        
while(1)
        {
            scanf(
"%s",&s);
            
if(s[0]=='#')
              
break;
            
if(ans[s]==1
            {
                cout
<<s<<" is correct"<<endl;

            } 
            
else
            {
                cout
<<s<<":";
               
for(int j=0;j<i;j++)
              {
                
if(solve(s,str[j]))
                  cout
<<" "<<str[j];
              }
              cout
<<endl;
            } 
        }
        cout
<<endl;
        
  }

  
//system("PAUSE");
  return   0;
  }
posted on 2009-07-06 20:13 luis 閱讀(283) 評(píng)論(0)  編輯 收藏 引用 所屬分類: 格式.輸入輸出.數(shù)據(jù)類型
<2009年7月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

常用鏈接

留言簿(3)

隨筆分類

隨筆檔案

文章分類

文章檔案

友情鏈接

搜索

  •  

最新評(píng)論

閱讀排行榜

評(píng)論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            欧美在线视频观看| 久久久五月婷婷| 伊人成综合网伊人222| 久久精品综合| 欧美精品一区二区高清在线观看| 午夜欧美精品| 欧美一区三区三区高中清蜜桃| 亚洲视频图片小说| 在线视频日韩| 亚洲欧美在线aaa| 久久国产一区二区| 麻豆精品国产91久久久久久| 欧美国产日本| 国产精品xxx在线观看www| 国产精品初高中精品久久| 久久久久亚洲综合| 欧美大片免费久久精品三p| 欧美精选在线| 国产欧美精品日韩| 亚洲国产精品va在线看黑人动漫 | 久久国产精品高清| 午夜精品久久久| 久久国产精品毛片| 亚洲国产欧美日韩精品| 亚洲人午夜精品| 亚洲男人第一av网站| 久久精品99国产精品| 欧美国产日本高清在线| 国产乱理伦片在线观看夜一区| 在线观看国产成人av片| 洋洋av久久久久久久一区| 欧美在线播放| 亚洲啪啪91| 亚洲深夜影院| 老司机久久99久久精品播放免费 | 欧美专区在线播放| 欧美日韩人人澡狠狠躁视频| 国产一区二区成人| 亚洲男女毛片无遮挡| 欧美成人日韩| 性欧美在线看片a免费观看| 欧美精品色综合| 在线看片日韩| 欧美诱惑福利视频| 在线视频你懂得一区二区三区| 久久精品中文| 国产麻豆日韩欧美久久| 99精品国产在热久久下载| 久久伊人免费视频| 亚洲性视频h| 欧美色欧美亚洲高清在线视频| 午夜欧美精品| 国产精品久久久久影院亚瑟| 国产一二精品视频| 午夜精品免费| 亚洲一区在线看| 欧美日韩一二区| 99精品福利视频| 亚洲啪啪91| 欧美精品激情| 一区二区欧美激情| 亚洲高清久久| 欧美成在线视频| 亚洲精品国产精品国自产在线 | 亚洲欧美国产精品va在线观看| 欧美日本免费| 亚洲一区精品电影| 在线一区欧美| 国产欧美日本| 久久国产精品99精品国产| 亚洲综合国产| 国产一区激情| 免费国产一区二区| 欧美sm极限捆绑bd| 亚洲精品在线视频观看| 亚洲精品一二三| 欧美视频在线观看| 欧美一级大片在线免费观看| 亚洲女人小视频在线观看| 国产女优一区| 免费在线成人av| 免费日韩精品中文字幕视频在线| 亚洲国产美女| 亚洲美女一区| 国产欧美一区二区三区另类精品 | 夜夜精品视频| 亚洲午夜电影网| 国产在线观看一区| 欧美成人嫩草网站| 欧美日韩在线不卡| 久久国产日韩| 欧美暴力喷水在线| 亚洲专区一区二区三区| 欧美一级夜夜爽| 亚洲精品视频在线看| 妖精视频成人观看www| 免费欧美日韩| 午夜视频在线观看一区二区三区| 久久成人18免费网站| 亚洲六月丁香色婷婷综合久久| 日韩视频在线观看| 黄色欧美成人| 一区二区不卡在线视频 午夜欧美不卡在 | 欧美成人免费在线视频| av不卡在线看| 欧美在线不卡视频| 亚洲黄一区二区| 亚洲一区二区三区视频播放| 在线观看视频亚洲| 亚洲一区二区三区国产| 亚洲黄色一区二区三区| 亚洲午夜一二三区视频| 亚洲精品久久久久久一区二区| 亚洲专区免费| 一区二区三区国产| 久久亚洲欧美国产精品乐播| 亚洲视频观看| 欧美黄色小视频| 美日韩在线观看| 国产欧美一区视频| 夜夜嗨网站十八久久| 亚洲激情网址| 久久精品日韩| 欧美在线啊v| 国产精品久久久久久久久免费| 亚洲高清免费视频| 亚洲二区在线| 久久久噜噜噜久久中文字幕色伊伊| 亚洲午夜一区二区三区| 欧美激情小视频| 亚洲承认在线| 91久久精品国产91性色tv| 欧美在线观看网站| 欧美亚洲一级| 国产精品久久久久秋霞鲁丝| 亚洲精品一区在线观看| 激情婷婷欧美| 久久国产精品久久久久久电车| 欧美一区二区三区免费观看视频 | 亚洲裸体视频| 99热在这里有精品免费| 久久综合久久综合九色| 另类成人小视频在线| 国内精品久久久| 欧美一级久久久久久久大片| 欧美一区日韩一区| 国产日韩精品电影| 欧美一区二区视频97| 欧美在线一二三四区| 国产婷婷精品| 久久久亚洲欧洲日产国码αv | 久久精品日韩一区二区三区| 久久久人成影片一区二区三区| 国产一区二区中文| 久久在精品线影院精品国产| 欧美成人在线影院| 日韩亚洲国产精品| 欧美偷拍另类| 午夜久久99| 久久这里只有精品视频首页| 玉米视频成人免费看| 农村妇女精品| 亚洲视频一区二区| 免费试看一区| 在线日韩日本国产亚洲| 欧美成人精品在线| 日韩视频在线免费观看| 亚洲欧美日韩国产一区二区| 国产日本欧美一区二区| 久久午夜电影| 亚洲小说区图片区| 欧美1区2区3区| 校园春色国产精品| 亚洲人成艺术| 国产三级精品三级| 欧美剧在线观看| 久久精品国产精品亚洲精品| 亚洲裸体俱乐部裸体舞表演av| 久久国产乱子精品免费女| 亚洲久色影视| 尤物九九久久国产精品的特点| 欧美日韩中文字幕在线| 久久久亚洲成人| 午夜精品久久久| 亚洲精品国精品久久99热一| 久久久久国产一区二区三区四区| 99国产麻豆精品| 激情久久五月| 国产精品综合av一区二区国产馆| 牛夜精品久久久久久久99黑人 | 99热免费精品在线观看| 国产亚洲欧洲一区高清在线观看| 欧美激情欧美狂野欧美精品| 欧美一区激情视频在线观看| 91久久精品国产| 老司机午夜精品视频| 亚洲欧美日韩另类| 一区二区电影免费在线观看| 激情久久久久久| 日韩亚洲一区在线播放|