A user input is required for an application you are developing in Kotlin. The application should prompt the user to enter a string, display the entered string, and then output the length of the string that the user inputted. However, some parts of the code are missing. Can you fill the blanks in the code to make the program work as expected?
String basics
Prompting user input and measuring string length
Report a typo
Fill in the gaps with the relevant elements
import java.util.
fun main(args: Array<String>) {
val scanner = Scanner(System.`in`)
println("Enter a string:")
val inputString = scanner.()
println("You entered: $inputString")
val = inputString.length
println("Length of your string is: $length")
} ___
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.