fork download
  1. fun main(args:Array<String>){
  2. val ans = readLine()!!.split(",").map { x ->
  3. x.toInt()
  4. }.filter { x ->
  5. x%2 == 1
  6. }.map { x ->
  7. x*x
  8. }.toList()
  9. println(ans)
  10. }
Success #stdin #stdout 0.08s 4382720KB
stdin
1,2,3,4,5,6,7,8,9,10
stdout
[1, 9, 25, 49, 81]