All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > General > Word Problems
Letter Ratios II (Posted on 2022-04-03) Difficulty: 3 of 5
Determine the word/words with the greatest consonant to vowel ratio.

Notes:
→ No proper nouns, abbreviations/acronyms, slangs, esoteric/archaic words. Also, hyphenated words like A-bomb are NOT permissible.
→ Consider Y as a vowel.
→ The word must have at least one vowel.

See The Solution Submitted by K Sengupta    
Rating: 3.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution the computer says Comment 2 of 2 |
clearvars,clc
maxratio=0;
fid=fopen("c:\words\words.txt","r");
while ~feof(fid)
   w=fgetl(fid);
   if ~isequal(w,lower(w))
      continue 
   end
   l=length(w);
   vowels=0;
   for i=1:l
      if contains("aeiouy",w(i)) 
         vowels=vowels+1; 
      end
   end
   if vowels==0
      continue 
   end
   ratio=(l-vowels)/vowels;
   if ratio>=maxratio
      disp([w ' ' char(string(ratio))]) 
      maxratio=ratio;
   end
end
fclose(fid);

finds at the end

strengths 8
tsktsking 8


  Posted by Charlie on 2022-04-03 10:20:47
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (6)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information