We’re preparing your current view and syncing the latest data.
You are given a string consisting of digits. Your task is to find and print the longest substring containing only the digits '4' and '7'. If there are multiple such substrings of the same maximum length, print the one that appears first. If no such substring exists, print "-1".
A single line contains a non-empty string of digits.
Print the longest substring consisting only of digits '4' and '7'. If there is no such substring, print "-1".
The length of the string will not exceed 10^5.
Example 1
Input
74244747477734
Output
474777
Explanation
The longest substring consisting only of '4' and '7' is "474777".
Example 2
Input
123456
Output
-1
Explanation
No substring consists only of '4' and '7', so print "-1".