File tree Expand file tree Collapse file tree 2 files changed +69
-0
lines changed Expand file tree Collapse file tree 2 files changed +69
-0
lines changed Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "bufio"
5
+ . "fmt"
6
+ "io"
7
+ )
8
+
9
+ // github.com/EndlessCheng/codeforces-go
10
+ func CF4C (_r io.Reader , _w io.Writer ) {
11
+ in := bufio .NewReader (_r )
12
+ out := bufio .NewWriter (_w )
13
+ defer out .Flush ()
14
+
15
+ var n int
16
+ var s string
17
+ cnt := map [string ]int {}
18
+ for Fscan (in , & n ); n > 0 ; n -- {
19
+ Fscan (in , & s )
20
+ if cnt [s ] > 0 {
21
+ Fprintf (out , "%s%d\n " , s , cnt [s ])
22
+ } else {
23
+ Fprintln (out , "OK" )
24
+ }
25
+ cnt [s ]++
26
+ }
27
+ }
28
+
29
+ //func main() { CF4C(os.Stdin, os.Stdout) }
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "github.com/EndlessCheng/codeforces-go/main/testutil"
5
+ "testing"
6
+ )
7
+
8
+ // https://codeforces.com/problemset/problem/4/C
9
+ // https://codeforces.com/problemset/status/4/problem/C
10
+ func TestCF4C (t * testing.T ) {
11
+ // just copy from website
12
+ rawText := `
13
+ inputCopy
14
+ 4
15
+ abacaba
16
+ acaba
17
+ abacaba
18
+ acab
19
+ outputCopy
20
+ OK
21
+ OK
22
+ abacaba1
23
+ OK
24
+ inputCopy
25
+ 6
26
+ first
27
+ first
28
+ second
29
+ second
30
+ third
31
+ third
32
+ outputCopy
33
+ OK
34
+ first1
35
+ OK
36
+ second1
37
+ OK
38
+ third1`
39
+ testutil .AssertEqualCase (t , rawText , 0 , CF4C )
40
+ }
You can’t perform that action at this time.
0 commit comments