Alice sends messages through an automated system which tags user details like the receiver's name, and their age. She realizes that many times, the first character of the message and the length of the entire message play a critical role in interpreting the messages correctly. Fill the blanks in the code fragment to extract the first character of the message and compute the length of the entire message.
Working with strings
Extracting first character and computing message length
Report a typo
Fill in the gaps with the relevant elements
fun main() {
val name = "Alice"
val age = 20
val message = "Hello, $name! You are $age years old."
val firstChar = message.()
println("First character of the message is '$firstChar'.")
println("Message Length: ${message.}.")
}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.