Counting points
Time limit1sMemory limit1024 MB
Given a string of n test results (T or N), count the groups of n/10 consecutive tests where every test is solved, and print that count.
- Level
Easy1 of 10
- Topics
- String, Implementation
- Solved
- No attempts yet
Problem
The jury of the Potyczki Algorytmiczne is tired of counting points for every submission. Write a program that automates this process.
Each problem awards between 0 and 10 points. A problem has tests, where is divisible by 10. A solution earns 1 point if it solves all of the first tests. It earns another point if it solves all of the next tests. Each group of tests can earn its point independently, but only if every test in that group is solved correctly. A single mistake in a group means that group earns no point.
Note: To keep things simple, we assume every test group has the same number of tests. In a real contest, this may not be true.
Note 2: Any code you write may be used against you.*
- A cosmonaut joke.
Input
The first line contains an integer (, is divisible by 10), the number of tests.
The second line contains a string of characters, each either 'T' or 'N'. 'T' means the test was solved correctly. 'N' means it was not.
Output
Print one integer, the number of points earned.
Hint
Explanation of the first example: The solution earns one point each for groups 1, 3, and 10. Groups 4 and 5 are partially solved, so they earn no points.