1. List Collection Complete the program that will reverse each word on the given string B fun main() { print("Enter a string: ") val str = rdLn() val words = str.split("") val newStr = wordReverse (words) println("new string length: ${newStr.length}") println(newStr) } fun wordReverse (words: List): String{ //List Manipulation Code Here

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 12RQ
icon
Related questions
Question
1. List Collection
Complete the program that will reverse each word on the given string
E
fun main() {
print("Enter a string: ")
val str = rdLn()
val words str.split("")
val newStr wordReverse (words)
println("new string length: ${newStr.length}")
println(newStr)
}
fun wordReverse (words: List<String>): String{
//List Manipulation Code Here
}
private fun rdLn() = readLine()!!
private fun rdInt() = rdLn().toInt ()
Enter a string: the quick brown fox
new string length: 19
eht kciuq nworb xof
Enter a string: there are 10 boys
new string length: 17
ereht era 01 syob
Enter a string: red blue @#$% yellow
new string length: 20
der eulb %$#@ wolley
Example output 1:
Example output 2:
Example output 3:
Transcribed Image Text:1. List Collection Complete the program that will reverse each word on the given string E fun main() { print("Enter a string: ") val str = rdLn() val words str.split("") val newStr wordReverse (words) println("new string length: ${newStr.length}") println(newStr) } fun wordReverse (words: List<String>): String{ //List Manipulation Code Here } private fun rdLn() = readLine()!! private fun rdInt() = rdLn().toInt () Enter a string: the quick brown fox new string length: 19 eht kciuq nworb xof Enter a string: there are 10 boys new string length: 17 ereht era 01 syob Enter a string: red blue @#$% yellow new string length: 20 der eulb %$#@ wolley Example output 1: Example output 2: Example output 3:
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Map
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,