COCI '19 Contest 5 #1 Emacs

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 512M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

While playing in his favourite text editor, Daniel decided to draw a picture that was N characters high and M characters wide. The picture consists solely of characters . and * such that characters * form some non-overlapping rectangles. The rectangles don’t even touch each other on their sides or corners.

Help Daniel count the number of rectangles drawn on the picture.


The first line contains two integers N and M (1 \le N, M \le 100) from task description.

Each of the next N lines contains M characters . or * which represent the picture that Daniel drew.


In a single line you should output the number of rectangles on the picture.


In the test cases worth a total of 20\% of the points, all rectangles will consist of a single * character.

In the test cases worth additional 30\% of the points, it will hold N = 1.

Sample Input 1

6 7

Sample Output 1


Sample Input 2

3 3

Sample Output 2


Sample Input 3

1 10

Sample Output 3



There are no comments at the moment.