Country search

Report a typo

You have a map val map = mapOf("NG" to "Nigeria", "AU" to "Australia", "CA" to "Canada", "BG" to "Bulgaria", "DE" to "Germany") containing country codes and country names. Implement the search for a country by code using iterator and print the result to the screen.

Sample Input 1:

CA

Sample Output 1:

Canada
Write a program in Kotlin
fun main() {
val map = mapOf(
"NG" to "Nigeria",
"AU" to "Australia",
"CA" to "Canada",
"BG" to "Bulgaria",
"DE" to "Germany"
)
val mapIterator = map.iterator()
val input = readln().uppercase()
// put your code here
}
___

Create a free account to access the full topic