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

Home > General > Cryptography
Countries of the World II (Posted on 2023-01-11) Difficulty: 3 of 5
Think of this problem as an extension to Countries of the World.

The nine country names below (spelled out in upper case) have been encoded in the following manner:

C = CMNRSVWXZ
B = BDFHKLT
G = GJPQ
A = AEIOU
Y = Y

What are the nine countries?

  1. acabcaa
  2. bacacacac cagabbac
  3. gacagaay
  4. bacaab
  5. ccabcacbacb
  6. bacbacac
  7. babacac
  8. acbabacbac
  9. bgabaaba

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

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution Comment 2 of 2 |
clearvars,clc
fid=fopen("c:\vb5 projects\flooble\country list.txt");
i=0; country=string.empty;
while ~feof(fid)
  l=fgetl(fid);
  if length(l)>4 && ~isequal('Top of Page',l )
     i=i+1;
     country(i)=lower(string(l));
  end
end
fclose(fid);

coded={};
for i=1:length(country)
   coded{end+1}=char(country(i));
end


 
for i=1:length(coded)
   for j=1:length(coded{i})
      l=coded{i}(j);
      if ismember(l, 'cmnrsvwxz')
        coded{i}(j)='c';
      elseif ismember(l , 'bdfhklt')
        coded{i}(j)='b';
      elseif ismember(l , 'gjpq')
        coded{i}(j)='g';
      elseif ismember(l , 'aeiou')
        coded{i}(j)='a';
      elseif l=='y'
        coded{i}(j)='y';
      end
   end
end

for i=1:length(coded)
   coded{i} = string(coded{i});
end

codes= {"acabcaa",
  "bacacacac cagabbac"
  "gacagaay"
  "bacaab"
  "ccabcacbacb"
  "bacbacac"
  "acbabacbac"
  "bgabaaba"
  };

for i=1:length(codes)
  disp(i)
   for j=1:length(coded)
     if codes{i}==coded{j}
        disp(country(j))
     end
   end
end

     1
eritrea
     2
dominican republic
     3
paraguay
     4
kuwait
     5
switzerland
     6
honduras
     7
uzbekistan
     8
djibouti


  Posted by Charlie on 2023-01-11 09:12:16
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (9)
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