{ it length }!!length var min = listOfStrings minBy { it


Download 52.68 Kb.
Sana05.01.2022
Hajmi52.68 Kb.
#215272
Bog'liq
3-amaliy, Alibek


Amaliy ish №3
O’zbekcha so’zlardan iborat satr berilgan. Satrdagi eng uzun va eng kichik

so’z uzunligini aniqlovchi dastur yozing.


fun main() {

var listOfStrings = readLine()!!.split(' ')

var max = listOfStrings.maxBy { it.length }!!.length

var min = listOfStrings.minBy { it.length }!!.length



println("max string is ${max}")

println("min string is ${min}")

}

O’zbekcha so’zlardan iborat satr berilgan. So’zlar orasida probellar bir

nechta va shu satrdagi ortiqcha probellarni olib tashlovchi sodda dastur

yozing.
fun main() {

var listOfStrings = readLine()?.split(' ')

var ansString = ""

listOfStrings?.forEach {

ansString+= if (it!="")"${it} " else ""



}

ansString = ansString.trim()



println(ansString)

}


Download 52.68 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling