Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.72 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "bufio"
  5.     "os"
  6. //  "strings"
  7.     "fmt"
  8. )
  9.  
  10. func main() {
  11.     m := make(map[string]int, 1)
  12.     for i := 0; i < 4; i++ {
  13.         reader := bufio.NewReader(os.Stdin)
  14.         text, _ := reader.ReadString('\r')
  15.         // fmt.Println(text)
  16.         // text = strings.TrimSuffix(text, "\n")
  17.         text_c := []rune(text)
  18.         if len(text_c) == 0 {
  19.             continue
  20.         } else if text_c[0] == '\r' || text_c[0] == '\n' {
  21.             continue
  22.         }
  23.         // fmt.Println(text_c)
  24.         tmp_j := 0
  25.         for j, n := range text_c {
  26.             if n == ' ' || n == '\r' || n == '\n' {
  27.                 tmp := text_c[tmp_j:j]
  28.                 // fmt.Println(string(tmp))
  29.                 if string(tmp) == "" {
  30.                     continue
  31.                 }
  32.                 m[string(tmp)] ++
  33.                 // text_c = text_c[j+1:]
  34.                 tmp_j = j + 1
  35.             }
  36.         }
  37.     }
  38.     fmt.Println(len(m))
  39.     // fmt.Println(m)
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement