Complete the code to declare an infix function named shout for the String class.
infix fun String.[1]() = this.uppercase() + "!"
The infix function is named shout to match the intended usage.
Complete the code to call the infix function shout on the string "hello".
val loud = "hello" [1] shout()
Infix functions are called without dots or parentheses, but since shout has no parameters, parentheses are optional. Here, the dot is needed to call the function normally.
Fix the error in the infix function declaration by completing the code.
infix fun Int.[1](times: Int): Int = this * timesThe function name times is a common and readable infix function name for multiplication.
Fill both blanks to create a dictionary comprehension that maps words to their uppercase form only if the word length is greater than 3.
val result = words.associateWith { it.[1]() }.filter { it.key.length [2] 3 }lowercase() instead of uppercase().The uppercase() function converts strings to uppercase, and the filter keeps words longer than 3 characters.
Fill all three blanks to create a map from uppercase keys to their lengths, only for words longer than 4 characters.
val map = words.filter { it.length [1] 4 }.associateBy( [2] ) { it.[3] }Filter words longer than 4, use uppercase words as keys, and map to their length.