You get a string of words in the input. Find a word with the minimum Levenshtein distance to the first word in the input string. If there are two or more words that comply to this condition, print out the first one.
Levenshtein distance
The nearest word
Report a typo
Sample Input 1:
grewsome grisly frightful horrid ghastly awesome gruesomeSample Output 1:
gruesomeWrite a program in Python 3
import nltk
from nltk import word_tokenize
# you get a string of words in the input
# we tokenized these words for you
all_words = list(word_tokenize(str(input())))
word = all_words[0] # you have to compare this word with others
others = all_words[1:] # other words stored here
# code below
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.