|
@@ -13,7 +13,7 @@ func encodeWord(word []rune) []rune {
|
|
}
|
|
}
|
|
|
|
|
|
if wordLength == 4 {
|
|
if wordLength == 4 {
|
|
- word[2], word[3] = word[3], word[2]
|
|
|
|
|
|
+ word[1], word[2] = word[2], word[1]
|
|
return word
|
|
return word
|
|
}
|
|
}
|
|
|
|
|
|
@@ -31,18 +31,7 @@ func processText(text []rune) string {
|
|
var newString []rune
|
|
var newString []rune
|
|
|
|
|
|
for _, item := range text {
|
|
for _, item := range text {
|
|
- if unicode.IsPunct(item) {
|
|
|
|
- currentWord = encodeWord(currentWord)
|
|
|
|
- for _, letter := range currentWord {
|
|
|
|
- newString = append(newString, letter)
|
|
|
|
- }
|
|
|
|
- currentWord = []rune{}
|
|
|
|
-
|
|
|
|
- newString = append(newString, item)
|
|
|
|
- continue
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if unicode.IsSpace(item) {
|
|
|
|
|
|
+ if unicode.IsPunct(item) || unicode.IsSpace(item) {
|
|
currentWord = encodeWord(currentWord)
|
|
currentWord = encodeWord(currentWord)
|
|
for _, letter := range currentWord {
|
|
for _, letter := range currentWord {
|
|
newString = append(newString, letter)
|
|
newString = append(newString, letter)
|