File tree 2 files changed +75
-0
lines changed
2 files changed +75
-0
lines changed Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import "fmt"
4
+
5
+ func main () {
6
+ //Enter your code here. Read input from STDIN. Print output to STDOUT
7
+ var bookSize int
8
+ var key string
9
+ var value uint64
10
+ fmt .Scan (& bookSize )
11
+
12
+ contactBook := make (map [string ]uint64 )
13
+
14
+ for i := 0 ; i < bookSize ; i ++ {
15
+
16
+ fmt .Scan (& key )
17
+ fmt .Scan (& value )
18
+ contactBook [key ] = value
19
+ }
20
+
21
+ var query string
22
+
23
+ for {
24
+
25
+ fmt .Scan (& query )
26
+
27
+ if _ , found := contactBook [query ]; found {
28
+ fmt .Print (query ,"=" ,contactBook [query ], "\n " )
29
+ } else {
30
+ fmt .Println ("Not found" )
31
+ }
32
+
33
+ if query == "" {
34
+ break
35
+ }
36
+ }
37
+
38
+ }
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import "fmt"
4
+ import "bufio"
5
+ import "os"
6
+
7
+ func main () {
8
+ //Enter your code here. Read input from STDIN. Print output to STDOUT
9
+ var bookSize int
10
+ var key string
11
+ var value uint64
12
+ fmt .Scan (& bookSize )
13
+
14
+ contactBook := make (map [string ]uint64 )
15
+
16
+ for i := 0 ; i < bookSize ; i ++ {
17
+
18
+ fmt .Scan (& key )
19
+ fmt .Scan (& value )
20
+ contactBook [key ] = value
21
+ }
22
+
23
+
24
+ scanner := bufio .NewScanner (os .Stdin )
25
+ 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" )
33
+ }
34
+ }
35
+
36
+
37
+ }
You can’t perform that action at this time.
0 commit comments