CHALLENGE: Unique Country Codes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

CHALLENGE: Unique Country Codes

Given a list of countries names like ["australia", "austria", "truky", "turkmenistan", "united kingdom"] Write a program that will output 2 character long unique code for a country like "au" for australia and "as" for austria and so on. Note the first character of the code should also be the first character of the country's name, and the sequence of the code should also follow the sequence of the character in country's name, like for countries with same char: "au" for 1st & "as" for 2nd not "at" or "ar"

12th Apr 2018, 4:47 PM
OR!ON 🛡️
OR!ON 🛡️ - avatar
5 Answers
12th Apr 2018, 6:08 PM
VcC
VcC - avatar
12th Apr 2018, 6:34 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 1
Orion (ओरायन) What should be the output for "united kingdom"? "un" or "uk" ?
12th Apr 2018, 5:20 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 1
nice VcC
14th Apr 2018, 3:15 PM
OR!ON 🛡️
OR!ON 🛡️ - avatar
16th Apr 2018, 6:14 PM
OR!ON 🛡️
OR!ON 🛡️ - avatar