ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

USU Junior Championship. March 2001

About     Problems     Submit solution     Judge status     Standings
Contest is over

H. Verification with the Dictionary

Time limit: 0.5 second
Memory limit: 64 MB
Your English teacher recently told you that she dreams about an automated spelling correction system to correct and count the mistakes that her students make. The 8th of March is soon and you decided that if you write such a program and present it to your teacher, then she would be so happy that she might get more favorable to you at the exams. The task is to replace the words that differ from the ones in the dictionary not more than in one letter and to count the amount of fixed mistakes. Your teacher must have forgotten that her students might also skip or add letters. Excellent, you don't have to worry about these cases!


In the first and the next lines up until the separator line containing the only character `#' there are dictionary words, each word in its own line. In the lines following the separator line there is a text that you are to correct. There are no more than 100 words in the dictionary. The length of a word in the dictionary doesn't exceed 8 characters. The text to correct contains no more than 1000 words of the length up to 16 characters. The text consists of one or more lines of length up to 80 characters. The cumulative length of all lines doesn't exceed 10000 characters. All words are written in lower case. Words might only contain Latin letters from `a' to `z' (e.g. `one-seventh' consists of two words: `one' and `seventh'). The dictionary is compiled so that for each word no more than one variant of correction is possible. There's exactly one end of line character at the end of the text.


Output the corrected text keeping the initial formatting: punctuation marks, line breaks and words that are absent in the dictionary. In the next line output the number of fixed mistakes.


the rushia is the larjest cauntry in the vorld.
it ockupies abaut one-seventh of the earth's surfase.
it kovers the eastern park of yurope and the northern park of asia.
the russia is the largest country in the world.
it occupies about one-seventh of the earth's surface.
it covers the eastern part of europe and the northern part of asia.
Problem Author: Anton Botov
Problem Source: The 3rd high school children programming contest, USU, Yekaterinburg, Russia, March 4, 2001
To submit the solution for this problem go to the Problem set: 1089. Verification with the Dictionary