package main func strip(str string) (output string) { var ( start = 0 end = len(str) ) for ; start < len(str) && str[start] == ' '; start++ { } for ; end > 0 && str[end-1] == ' '; end-- { } return str[start:end] }