There are \(x\) number of girls and they rolled a dice in turns one after another.
If the number on the dice is \(6\), then the dice will be rolled again until she get a number other than \(6\).
Since you know the sequence of numbers which the dice shows when rolled each time, you have to find what is the total number of girls or if the sequence is invalid.
Input format
A single line that contains a string \(s\) \((1 \leq |s| \leq 10^5)\) denoting the sequence of numbers the dice rolls on written as string.
Output format
- If the sequence is valid print the number of girls
- If the sequence is invalid print \(-1\)
The second person rolls the dice \(3\) times so the number of people will be \(5\).
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor