In your strange local currency, there should only be
Your job is to determine how many counterfeited coins are mixed into a row of coins. This is more difficult than it looks. The coins are rectangular, so a row of coins looks something like this:
In order to count all the coins, you use a scanning machine that reads the digits on the top of the coins one by one. For the row of coins shown above, your machine will produce the string 622544252
.
Given a sequence of digits generated by the machine, please determine how many of the coins are counterfeit 25
in the sequence, it represents a non-counterfeit 2
in the sequence that is not followed by a 5
, you can assume that it is a counterfeit coin.
Input Specification
The first and only line of input will contain a sequence of digits from your coin-scanning machine, such as 622544252
.
Output Specification
Please output the number of counterfeit (
Constraints and Partial Marks
For all test cases, the string is
Additionally, for 5
.
Sample Input
2256624425252
Sample Output
3
Explanation for Sample Output
The sample input represents this row of coins:
In this row, there are three counterfeit
Comments
I don't understand why I get 0/4 on batch #1 but 6/6 for batch #2
I know 4 of the points has a test case where there are no $25 coins, but I tried all the possible test cases I can think of and they all pass. Can anyone recommend any test cases?
If you remove your debug prints on your latest solution, you pass. In the future, you can join the DMOJ Discord if you have any problems you need help with.