The TransCompilator

Solved LeetCode program · 731 of 1,000

#0966 · Vowel Spellchecker

Medium Array chunk-15.md

Original English source

Keep a shared words holding "Kiwi", "Kiwi", "apple", "apple", and "banana". Keep a shared lowers holding "kiwi", "kiwi", "apple", "apple", and "banana". Keep a shared vowels holding "k*w*", "k*w*", "*ppl*", "*ppl*", and "b*n*n*". Keep a shared queries holding "Kiwi", "kiwi", "Apple", "apple", "Banana", and "banana". Keep a shared querylowers holding "kiwi", "kiwi", "apple", "apple", "banana", and "banana". Keep a shared queryvowels holding "k*w*", "k*w*", "*ppl*", "*ppl*", "b*n*n*", and "b*n*n*". Keep a shared found of 0. Keep a shared wordlast of 0.
To exact from query (a whole number) with word (a whole number). If word is more than wordlast, return. If item query of queries matches item word of words, set found to word, return. Exact from query with word plus 1.

To lower from query (a whole number) with word (a whole number). If word is more than wordlast, return. If item query of querylowers matches item word of lowers, set found to word, return. Lower from query with word plus 1.

To vowel from query (a whole number) with word (a whole number). If word is more than wordlast, return. If item query of queryvowels matches item word of vowels, set found to word, return. Vowel from query with word plus 1.

Set wordlast to the last position of words. The querylast is the last position of queries.
For every query from 0 to querylast.
Set found to -1. Exact from query with 0. If found is less than 0, Lower from query with 0. If found is less than 0, Vowel from query with 0. The place is found. If found is at least 0, show item place of words, otherwise show "none".

Open in Playground Browse all 1,000 problems

Expected stdout

Kiwi
Kiwi
apple
apple
banana
banana