Skip to content

Commit 087aae3

Browse files
authored
Update map2.go
1 parent c277b65 commit 087aae3

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

Diff for: 08/map2.go

+6-11
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,21 @@ func main() {
1010
var key string
1111
var value uint64
1212
fmt.Scan(&bookSize)
13-
1413
contactBook := make(map[string]uint64)
1514

1615
for i := 0; i < bookSize; i++ {
17-
1816
fmt.Scan(&key)
1917
fmt.Scan(&value)
2018
contactBook[key] = value
2119
}
22-
23-
2420
scanner := bufio.NewScanner(os.Stdin)
21+
2522
for scanner.Scan() {
26-
27-
query := scanner.Text()
28-
29-
if _, found := contactBook[query]; found {
30-
fmt.Print(query,"=",contactBook[query], "\n")
31-
} else {
32-
fmt.Println("Not found")
23+
query := scanner.Text()
24+
if _, found := contactBook[query]; found {
25+
fmt.Print(query,"=",contactBook[query], "\n")
26+
} else {
27+
fmt.Println("Not found")
3328
}
3429
}
3530

0 commit comments

Comments
 (0)