题解 | #字符串反转#
字符串反转
https://www.nowcoder.com/practice/e45e078701ab4e4cb49393ae30f1bb04
package main import ( "fmt" ) func main() { var s string var s1 []byte var s2 []byte fmt.Scan(&s) s1 = []byte(s) for i := len(s1) - 1; i >= 0; i-- { s2 = append(s2, s1[i]) } fmt.Println(string(s2)) }