Created
March 3, 2021 18:15
-
-
Save nsmirosh/7512ff7c5b0dca975243247ae9169509 to your computer and use it in GitHub Desktop.
Initial task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class User(val id: String, val nickname: String) | |
data class Message(val id: String, val message: String?, val user: User) | |
val users = listOf( | |
User("000", "Bender"), | |
User("001", "Leela"), | |
User("002", "Fry"), | |
User("003", "Zoidberg") | |
) | |
val conversation: List<Message> = listOf( | |
Message("000", "Hello, I am Fry", users[2]), | |
Message("001", "Hello, I am Leela", users[1]), | |
Message("002", "Hello, I am Bender", users[2]), | |
Message("003", "Hello I am Zoidberg, Whoop, Whoop", users[3]), | |
Message("004", "I don't like to fool anyone", users[1]), | |
Message("005", "So I will tell you that", users[1]), | |
Message("006", "I'm cyclops", users[1]), | |
Message("007", "I am captain of a spaceship", users[1]), | |
Message("008", "I am the only one of my kind", users[1]), | |
Message("009", "and what I want is to meet a man", users[1]), | |
Message("010", null, users[3]), | |
Message("011", "My Story Is A Lot Like Yours, Only More Interesting ‘Cause It Involves Robots.", users[0]), | |
Message("012", "Anything Less Than Immortality Is A Complete Waste Of Time", users[0]), | |
Message("013", "Hey sexy mama. Wanna kill all humans?", users[0]), | |
Message("014", "Shut Up And Take My Money!", users[2]) | |
) | |
fun main() { | |
println("The most talkative character is: ${getTheMostTalkativeCharacter()}") // Print the name of the most talkative character | |
println("Messages by character: ${getMessageGroupedByCharacter()}") // Show all messages grouped by every character | |
println("name of the character that said longer sentence : ${longestSentenceSaidBy()}") // Print the name of the character that said longer sentence | |
println("Leela messages sorted by size: ${getLeelaMessagesSortedBySize()}") // Show all Leela message sorted by sentence size | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment