Ranging over a string yields a byte offset and a rune per step, with UTF-8 already decoded, so the loop sees É as one value. Each rune that passes unicode.IsLetter or unicode.IsDigit is lowercased and appended to cleaned, which starts out as a nil slice and grows through append. slices.Reverse returns nothing and flips the slice you hand it, so the function reverses a slices.Clone rather than cleaned itself, then lets slices.Equal check length and elements together. On "?! ." nothing gets appended, cleaned stays nil, its clone is empty as well, and two zero-length slices count as equal: no special case needed. Two rune slices of up to n elements are alive at once, which is the O(n) extra memory, paid twice.