#C1210. Markdown Element Counter

    ID: 41490 Type: Default 1000ms 256MiB

Markdown Element Counter

Markdown Element Counter

In this problem, you are given a markdown file containing multiple lines. Your task is to count the number of header lines and the number of list item lines. A header line is any line that starts with the character '#'. A list item line is any line that starts with the characters '-' or '+'.

More formally, if the file consists of NN lines, let $$ H = \sum_{i=1}^{N} [\text{line}i \text{ starts with } #] $$ and $$ L = \sum{i=1}^{N} [\text{line}_i \text{ starts with } - \text{ or } +]. $$

Output the counts as two integers: the first being the total number of header lines, and the second being the total number of list item lines.

inputFormat

The input is read from stdin. The first line contains a single integer NN, representing the number of lines in the markdown file. The next NN lines each contain a string that represents a line from the markdown file.

outputFormat

Print exactly two integers separated by a space. The first integer is the count of header lines (lines starting with '#') and the second integer is the count of list item lines (lines starting with '-' or '+').## sample

9
# Header 1
- Item 1
Some Text
## Header 2
+ Item 2
Another line
### Header 3
- Item 3
- Item 4
3 4

</p>