Imagine playing a game with a friend: you're trying to name as many words that start with the same letter as possible. You've already named some of them. The input contains a random number of words. If all words indeed start with the same letter you need to print them all in the same order, but if at least one word starts with a different letter, print nothing.
For loop and iterables
Words starting with the same letter
Report a typo
Sample Input 1:
fish fiacko feeling frenchSample Output 1:
fish fiacko feeling frenchSample Input 2:
dish cat dear dreamSample Output 2:
Write a program in Kotlin
fun main() {
val words: List<String> = readln().split(" ")
// output the result collection
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.