Minecraft Stone Counter!
View as PDF
Submit solution
Points:
3
Time limit:
2.0s
Memory limit:
64M
Problem type
Allowed languages
C, C++, Java, Python
Minecraft Stone Counter!
Steve is looking at a row of N blocks. Each block is either "STONE" or "DIRT".
Steve only needs to count the STONE blocks so he knows how many he can mine for building.
Your Task
Given N blocks (each either STONE or DIRT), count and print the number of STONE blocks.
Input Specification
Line 1: integer N
Line 2: N words, each either STONE or DIRT, space-separated
Output Specification
A single integer: the count of STONE blocks.
Sample Input
5
STONE DIRT STONE STONE DIRT
Sample Output
3
Constraints
Each word is either STONE or DIRT.
Comments