The Dice
Practice
3.9 (83 votes)
Basic programming
Basics of implementation
Easy
Implementation
Problem
92% Success 28532 Attempts 10 Points 2s Time Limit 256MB Memory 1024 KB Max Code

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\)

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

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:10
291 votes
Tags:
Basic ProgrammingEasy
Points:10
185 votes
Tags:
Ad-HocApprovedBasic ProgrammingEasyImplementationOpen
Points:10
81 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation