package main
import "bufio"
import "fmt"
import "os"
import "strings"
func main() {
table := make(map[string]string)
table["key1"] = "val1"
table["key2"] = "val2"
table["key3"] = "val3"
fmt.Println("Enter a key (followed by Return):")
reader := bufio.NewReader(os.Stdin)
input, err := reader.ReadString('\n')
if err != nil {
panic(err)
}
val, ok := table[input]
fmt.Println("val for key '" + input + "' = '" + val + "'(" + fmt.Sprintf("%v", ok) + ")")
input = strings.TrimRight(input, "\n\r")
val, ok = table[input]
fmt.Println("val for key '" + input + "' = '" + val + "'(" + fmt.Sprintf("%v", ok) + ")")
}
cGFja2FnZSBtYWluCgppbXBvcnQgImJ1ZmlvIgppbXBvcnQgImZtdCIKaW1wb3J0ICJvcyIKaW1wb3J0ICJzdHJpbmdzIgoKZnVuYyBtYWluKCkgewoJdGFibGUgOj0gbWFrZShtYXBbc3RyaW5nXXN0cmluZykKCgl0YWJsZVsia2V5MSJdID0gInZhbDEiCgl0YWJsZVsia2V5MiJdID0gInZhbDIiCgl0YWJsZVsia2V5MyJdID0gInZhbDMiCgoJZm10LlByaW50bG4oIkVudGVyIGEga2V5IChmb2xsb3dlZCBieSBSZXR1cm4pOiIpCglyZWFkZXIgOj0gYnVmaW8uTmV3UmVhZGVyKG9zLlN0ZGluKQoJaW5wdXQsIGVyciA6PSByZWFkZXIuUmVhZFN0cmluZygnXG4nKQoJaWYgZXJyICE9IG5pbCB7CgkJcGFuaWMoZXJyKQoJfQoKCXZhbCwgb2sgOj0gdGFibGVbaW5wdXRdCglmbXQuUHJpbnRsbigidmFsIGZvciBrZXkgJyIgKyBpbnB1dCArICInID0gJyIgKyB2YWwgKyAiJygiICsgZm10LlNwcmludGYoIiV2Iiwgb2spICsgIikiKQoJaW5wdXQgPSBzdHJpbmdzLlRyaW1SaWdodChpbnB1dCwgIlxuXHIiKQoJdmFsLCBvayA9IHRhYmxlW2lucHV0XQoJZm10LlByaW50bG4oInZhbCBmb3Iga2V5ICciICsgaW5wdXQgKyAiJyA9ICciICsgdmFsICsgIicoIiArIGZtdC5TcHJpbnRmKCIldiIsIG9rKSArICIpIikKfQ==