41 lines
655 B
Go
Raw Normal View History

2019-04-24 22:32:35 +03:00
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
in := bufio.NewScanner(os.Stdin)
p := newParser()
for in.Scan() {
2019-04-26 21:32:20 +03:00
add(p, in.Text())
2019-04-24 22:32:35 +03:00
}
2019-04-26 21:32:20 +03:00
for _, name := range p.domains {
// vis := p.sum[d.name]
d := p.sum[name]
2019-04-24 22:32:35 +03:00
2019-04-26 21:32:20 +03:00
fmt.Printf("%-25s -> %d\n", d.name, d.visits)
2019-04-24 22:32:35 +03:00
}
fmt.Printf("\n%-25s -> %d\n", "TOTAL", p.total)
2019-04-26 21:32:20 +03:00
if p.lerr != nil {
2019-04-27 10:45:47 +03:00
fmt.Println("> Err:", p.lerr)
}
if err := in.Err(); err != nil {
fmt.Println("> Err:", err)
2019-04-26 21:32:20 +03:00
}
2019-04-24 22:32:35 +03:00
}