如何将重复值计数到元组swift

时间:2016-11-15 16:24:44

标签: swift

问题: 需要计算数组中重复值的数量并将其放入元组中 像这样:

var array = ["a","a","b","a","c","b"]
answer = ["a":3,"b":2,"c":1]

0 个答案:

没有答案