SMILEY1807 - 1807
There is a SmileyLand of angels. The queen of all angels Smiley1807 loves the number 1807. She is so much obsessed with 1807 that she asked her programmer friend to write a program to find the length of the largest sub sequence having digits 1, 8, 0 and 7 in order. For example if given sequence is 1800777700088888000777 then one of the largest sub sequence satisfying the above condition is 1800000000777 (there is one more possibility of 1888888000777) and hence the length of largest sub sequence is 13.
Input
The input contains only one test case.
The test case consist of only one sequence which may be as long as 10^6. There are only 1, 8, 0 or 7 present in the input sequence.
Output
Output contains only one line containing the length of the largest sub-sequence.
Example
Input: 1800777700088888000777 Output: 13
Explanation
1800000000777 is the largest sub-sequence
hide comments
Saksham :
2015-08-29 21:45:19
nice problem,my 150th!! |
|
shikhargarg:
2015-08-29 12:59:19
Sometimes ... dp is not necessary ;) |
|
mehmetin:
2015-08-29 10:40:36
@Amitayush, I disqualified only my AC solutions, because they contained too much code or used too much memory :))
|
|
Amitayush Thakur:
2015-08-28 18:26:41
It is sad to see that most of the people disqualify their solution just to increase their AC rates. |
|
:.Mohib.::
2015-08-26 17:45:32
One Observation and AC :D...Nice Problem...!! |
|
Akhilesh Anandh:
2015-08-24 18:04:24
Should there be at least one each of 1,8,0,7? What is the answer for "187"?
|
|
Garima:
2015-08-22 22:57:43
Nice Question :)
|
|
Min_25:
2015-08-22 20:15:21
We cannot submit our solutions.
|
Added by: | Amitayush Thakur |
Date: | 2015-08-22 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | MAWK BC C NCSHARP CSHARP C++ 4.3.2 CPP CPP14 C99 COFFEE LISP sbcl LISP clisp DART FORTH HASK JAVA JULIA KTLN OCT PROLOG PYTHON PYPY3 PYTHON3 PY_NBC R RACKET SCALA SQLITE SWIFT UNLAMBDA |
Resource: | Own problem made for college competition CodeNite-1 |