cat data | go run main.go
Created
February 1, 2023 15:12
-
-
Save owulveryck/cd49dc82ae8b3bbfaf510821c489fbbf to your computer and use it in GitHub Desktop.
Random Coffee
This file contains hidden or 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
person1 | |
person2 | |
person3 | |
person4 |
This file contains hidden or 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" | |
"os" | |
) | |
func main() { | |
s := bufio.NewScanner(os.Stdin) | |
s.Split(bufio.ScanLines) | |
entries := make(map[string]struct{}) | |
for s.Scan() { | |
entries[s.Text()] = struct{}{} | |
} | |
separator := [2]string{" \u2615 ", "\n"} | |
i := 0 | |
for k := range entries { | |
fmt.Printf("@%v%v", k, separator[i%len(separator)]) | |
i++ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment