dictionary and a list of queries. For each query find its correct spelling using these rules, tried in order (the first one that applies wins):
1. If the query appears in the dictionary exactly (case-sensitive), return it as is.
2. Otherwise, if some dictionary word equals the query ignoring case, return the first such word as written in the dictionary.
3. Otherwise, if some dictionary word equals the query ignoring case once any vowel may stand in for any other vowel (one for one, the length stays the same), return the first such word from the dictionary.
4. Otherwise, return an empty string.
The vowels are a, e, i, o, u. Return the answers in the order of the queries.dictionary=['Mango', 'lemon', 'melon'], queries=['mango', 'MANGO', 'lemon', 'limon', 'milan', 'lime'] → ['Mango', 'Mango', 'lemon', 'lemon', 'melon', '']
mango and MANGO match Mango ignoring case. lemon is in the dictionary verbatim. limon differs from lemon by one vowel. milan fits melon. Nothing fits lime.
dictionary=['tea', 'Tea', 'toe'], queries=['TEA', 'tia', 'Tea'] → ['tea', 'tea', 'Tea']
For TEA the first case-insensitive match is tea. For tia the first vowel-tolerant match is also tea. Tea is in the dictionary exactly, so it comes back unchanged.
dictionary=['Mango', 'lemon', 'melon'], queries=['mango', 'MANGO', 'lemon', 'limon', 'milan', 'lime']
['Mango', 'Mango', 'lemon', 'lemon', 'melon', '']
Run checks the first 3 tests in your browser. Submit checks all 88 tests on the server, hidden ones included.