题解 | #截取字符串#
截取字符串
https://www.nowcoder.com/practice/a30bbc1a0aca4c27b86dd88868de4a4a
import Foundation // 简单题,麻烦的是swift 语法太严谨了 let string = Array(readLine()!) let k = Int(readLine()!)! var res = "" for i in 0..<k { res.append(string[i]) } print(res)