Created
December 27, 2022 14:52
-
-
Save bontusss/5b7b525b44699c2e04d5039454df52e2 to your computer and use it in GitHub Desktop.
Coolify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"math/rand" | |
"os" | |
"time" | |
) | |
const ( | |
duplicateVowel bool = true | |
removeVowel bool = false | |
) | |
func randBool() bool { | |
return rand.Intn(2) == 0 | |
} | |
func main() { | |
rand.Seed(time.Now().UTC().UnixNano()) | |
s := bufio.NewScanner(os.Stdin) | |
for s.Scan() { | |
word := []byte(s.Text()) | |
if randBool() { | |
var vI int = -1 | |
for i, char := range word { | |
switch char { | |
case 'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U': | |
if randBool() { | |
vI = i | |
} | |
} | |
} | |
if vI >= 0 { | |
switch randBool() { | |
case duplicateVowel: | |
word = append(word[:vI+1], word[vI:]...) | |
case removeVowel: | |
word = append(word[:vI], word[vI+1:]...) | |
} | |
} | |
} | |
fmt.Println(string(word)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment