Wrong typing question

Question Description

When you’re typing too fast you might press the wrong key. For example if you want to press G you might press its neighbours T, Y, F, H, V or B (all with distance 1 from G) or even worse by pressing farther letters like R (at distance 2) or Z(at distance

Given a word as search term, search among all hotel names and find every occurrence of that word with the distance of at most maximum distance.

Example Input:

{“maximum distance”: 3, “search_term”: “taj”),

Example Database:

[

“The King David Jerusalem Hotel, Jerusalem”, “Burj Al Arab Jumeirah, Dubai”,

“The Plaza, New York City”,

“Fairmont Le Chateau Frontenac, Quebec City”, “Old Faithful Inn, Yellowstone National Park”, “Grand Hotel Europe, St. Petersburg”,

“Disney’s Contemporary Resort, Florida”,

“The Beverly Hills Hotel, Beverly Hills”, “Taj Mahal, Mumbai”
]
Example output:

Found: rab, Distance: 3, Hotel: Burj Al Arab

Jumeirah, Dubai

Found: rah, Distance: 2, Hotel: Burj Al Arab Jumeirah, Dubai

Found: Fai, Distance: 2, Hotel: Fairmont Le Chateau

Frontenac, Quebec City

Found: eau, Distance: 3, Hotel: Fairmont Le Chateau

Frontenac, Quebec City

Found: ten, Distance: 3, Hotel: Fairmont Le Chateau

Frontenac, Quebec City

Found: Fai, Distance: 2, Hotel: Old Faithful Inn,

Yellowstone National Park

Found: ran, Distance: 2, Hotel: Grand Hotel Europe,

St. Petersburg

Found: tem, Distance: 3, Hotel: Disney’s

Contemporary Resort, Florida

Found: Taj, Distance: 0, Hotel: Taj Mahal, Mumbai

Could anyone please help me in this question , like I wanna know how could I find neighbour of words from keyboard at particular distance please help me.

Hi @mohitj27 hope this doubt is clear

Yes @talhashamim001, thanks for your help.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.