Problem E
Heimavinna
Languages
en
is
ja
Hneitir is a college student, meaning he has to do homework in various courses. Hneitir is not lazy, but he dislikes doing homework, especially when it comes to chemistry. Tomorrow he will be dragged to the board, being made to solve the assigned problems. The problem is that he does not know what problems to solve on the board since his chemistry teacher, Ormhildur, sometimes skips some problems to hurry things along. Even worse is that Hneitir has been procrastinating solving the problems and thus there are a lot of problems he has to solve for tomorrow. How many problems does he have to solve?
Input
The input consists of a single line specifying the problems Hneitir has to solve. Hneitir always has to solve at least one problem. The problems are numbered from $1$ up to $1\, 000$ and are given in increasing order, separated by semicolons (;). If Hneitir should solve two or more consecutive problems in a row it is denoted by -. An example of a possible input is 1-3;5;7;10-13 which would mean Hneitir has to solve problem 1,2,3,5,7,10,11,12,13.
Output
Print a single line with a single integer $n$, the number of problems Hneitir has to solve.
Scoring
Group |
Points |
Constraints |
1 |
25 |
The problems are all in one interval, e.g. 3-10 |
2 |
25 |
No two problems are consecutive, e.g. 1;3;5;8;13 |
3 |
50 |
No further constraints |
Sample Input 1 | Sample Output 1 |
---|---|
1-3;5;7;10-13 |
9 |
Sample Input 2 | Sample Output 2 |
---|---|
3-10 |
8 |
Sample Input 3 | Sample Output 3 |
---|---|
1;3;5;8;13 |
5 |