swift代码:思路是:反向读取+字符拼接
func charAtReverse(_ str:String) -> String {
var reverseStr:String = "";
for i in 0..<str.count {
let j = str.count-i-1;
let currentIndex = str.index(str.startIndex, offsetBy:j);
let currentStr = str[currentIndex]
reverseStr.append(currentStr);
}
return reverseStr;
}