Junior — Senior
What is the output of program №11
livecode
Task condition
The task requires determining what text will appear in the console after executing a chain of functions on an array of integers. The array is sorted, only positive elements are selected, each is converted to a string, and then the strings are concatenated into one without separators in reverse order. Output the resulting string.
import UIKit
let numbers = [-2, 3, 1, -4, -6, 5]
let output = numbers
.sorted()
.filter { $0 > 0 }
.map { String($0) }
.reduce("") { $1 + $0 }
print(output)