Created
February 1, 2023 15:12
-
-
Save owulveryck/cd49dc82ae8b3bbfaf510821c489fbbf to your computer and use it in GitHub Desktop.
Revisions
-
owulveryck created this gist
Feb 1, 2023 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ cat data | go run main.go 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ 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++ } }