The hawaiian language consists of 12 letters. There are 7 consonants: HKLMNP and
ID: 3586392 • Letter: T
Question
The hawaiian language consists of 12 letters. There are 7 consonants: HKLMNP and W aand there are five vowels: AEIO and U. In a word, no two consecutive letters can be consonants and all words must end in a a vowel. Suppose you're given, without spaces, a very long list of putative decrypts of a given cipher (where you know the plaintext is in Hawaiian). Lets say you have 2^{50} decrypts. The decrypts may only use the 12 letters. How would you program your computer to recognize the correct answer? Quantify how efficient your method would be and how long a text you would require to be able to differentiate between the causal answer and random “noise” (where you can assume that you don’t read or speak Hawaiian)?
Explanation / Answer
Conventions Used.
# - Comments
Code:-
# Two list that contain consonant and vowels.
vowel = ['a','e','i','o','u']
consonants = ['h','k','l','m','n','p']
Let a be a list that contain all the decryptions.
for i in a:
# Last element must be a vowel.
if i[-1] in vowels:
# loop through all the elements and check for any rules broken
for j in i:
if j not in vowels:
break
elif j not in consonants:
break
elif j in consonants and i[i.index(j)+1] in consonants:
break
O(n2) - Algorithm Performance.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.