12345678910111213141516171819202122232425262728 |
- package main
- import (
- "bufio"
- "fmt"
- "os"
- )
- func DUP1() {
- fmt.Printf("----------dup1 start ---------------")
- counts := make(map[string]int)
- input := bufio.NewScanner(os.Stdin)
- fmt.Printf("please input:\n")
- for input.Scan() && input.Text() != "end!" {
- counts[input.Text()]++
-
- }
-
- fmt.Printf("\ninput end!\n")
- for line, n := range counts {
-
- fmt.Printf("%d\t%s\n", n, line)
-
- }
- fmt.Printf("----------dup1 end ---------------")
- }
|