import Foundation
func solution(_ s:String) -> [Int] {
var a = s.split(separator: "}")
var b = a.map{
$0.split(whereSeparator: {
!$0.isNumber
})
}
var array = b.map{$0.map{Int($0)!}}
let countV = array.sorted{
$0.count < $1.count
}
var result = [Int]()
var memory = [Int]()
countV.forEach{ arr in
for i in 0..<arr.count{
if !memory.contains(arr[i]){
memory.append(arr[i])
}
}
}
return memory
}