The respective number of "i"s and "o"s in any given word is denoted by I and O.
o (1)(a) Determine the longest common English word/words having the maximum value of Ι/Ο
o (1)(b) Determine the longest common English word/words having the minimum value of Ι/Ο
o (1)(c) Determine the longest common English word/words with Ι=Ο
o (2) Extend (1) to cover the case of esoteric/archaic words.
Notes
- The valid word/words must have at least one "i" and at least one "o".
- No abbreviations/acronyms/slangs and no hyphenated words like A-Bomb, X-ray etc.
clearvars,clc
fid=fopen('c:\words\words.txt','r');
mx=0; mn=999;
while ~feof(fid)
w=fgetl(fid);
if w==lower(w)
if ~isequal(strfind(w,'i'),[])
if ~isequal(strfind(w,'o'),[])
ict=length(strfind(w,'i'));
oct=length(strfind(w,'o'));
rat=ict/oct;
if rat>mx
mx=rat;
elseif rat<mn
mn=rat;
end
end
end
end
end
fclose(fid);
disp([mn mx])
fid=fopen('c:\words\words.txt','r');
while ~feof(fid)
w=fgetl(fid);
if w==lower(w)
if ~isequal(strfind(w,'i'),[])
if ~isequal(strfind(w,'o'),[])
ict=length(strfind(w,'i'));
oct=length(strfind(w,'o'));
rat=ict/oct;
if rat==mn
disp([w ' ' char(string(length(w)))])
elseif rat==1 && length(w)>20
disp([' ' w ' ' char(string(length(w)))])
elseif rat==mx
disp([' ' w ' ' char(string(length(w)))])
end
end
end
end
end
fclose(fid);
finds
0.2 as the smallest ratio and 6 as the largest
In the below list, the longest word with the lowest ratio is photophosphorylations with 21 letters.
The longest with the highest ratio is incorrigibilities with 17 letters.
The longest with ratio 1 is electrocardiographically and also phosphatidylethanolamine, each having 24 letters.
acetylcholinesterases 21
clinicopathologically 21
compartmentalizations 21
counterinterpretation 21
counterinterpretations 22
disadvantageousnesses 21
electrocardiographically 24
electrocardiographies 21
electroretinographies 21
encephalomyocarditises 22
glottochronological 19
glottochronologies 18
incorrigibilities 17
nondenominationalisms 21
nonrepresentationalism 22
nonrepresentationalisms 23
otorhinolaryngology 19
overcommercialization 21
overcommercializations 22
phosphatidylethanolamine 24
photophosphorylation 20
photophosphorylations 21
protozoologies 14
protozoologist 14
protozoologists 15
pseudosophistications 21
psychotherapeutically 21
straightforwardnesses 21
undemonstrativenesses 21
unexceptionablenesses 21
>>
|
Posted by Charlie
on 2022-12-24 12:59:42 |