Files
learngo/23-input-scanning/exercises/05-quit/solution/main.go

31 lines
471 B
Go
Raw Normal View History

2019-04-12 16:55:26 +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"
"strings"
)
func main() {
in := bufio.NewScanner(os.Stdin)
2019-05-07 12:17:07 +03:00
words := make(map[string]bool)
2019-04-12 16:55:26 +03:00
for in.Scan() {
2019-05-07 12:17:07 +03:00
w := strings.ToLower(in.Text())
if words[w] {
fmt.Println("TWICE!")
return
2019-04-12 16:55:26 +03:00
}
2019-05-07 12:17:07 +03:00
words[in.Text()] = true
2019-04-12 16:55:26 +03:00
}
}