Go solution with a direction flag
go\nfunc sortString(s string) string {\n\tchars := make([]int, 26)\n\tfor _, ch := range s {\n\t\tchars[ch-97]++\n\t}\n\n    var buf strings.Builder\n\ti, direc
```go\nfunc sortString(s string) string {\n\tchars := make([]int, 26)\n\tfor _, ch := range s {\n\t\tchars[ch-97]++\n\t}\n\n    var buf strings.Builder\n\ti, direction := 0, 1\n\tfor buf.Len() < len(s) {\n\t\tif i == 26 {\n\t\t\ti = 25\n\t\t\tdirection = -1\n\t\t}\n\t\t\n\t\tif i == -1 {\n\t\t\ti = 0\n\t\t\tdirection = 1\n\t\t}\n\t\tif chars[i] > 0 {\n\t\t\tbuf.WriteByte(byte(i + 97))\n\t\t\tchars[i]--\n\t\t}\n\n\t\ti += direction\n\t}\n\n    return buf.String()\n}\n```
['Go']