-
Notifications
You must be signed in to change notification settings - Fork 2
/
122B.cpp
41 lines (36 loc) · 937 Bytes
/
122B.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Author : Mars_Coder
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
using namespace std;
#define PI 3.141592653589793238462643383279502884L
#define ln "\n" // no flush, oppos of endl
#define _flush endl
#define stop_sync ios::sync_with_stdio(false) // not to use c-stye io
#define untie_ios cin.tie(nullptr) // no flush
#define sz(x) (x).size()
#define lli long long int
#define FIXED(x) cout << fixed << setprecision(x)
int main(void){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
freopen("error.txt", "w", stderr);
#endif
string s;
cin >> s;
int cnt = 0;
for(int i = 0; i < sz(s); ++i){
if(s[i] == '4' || s[i] == '7') ++cnt;
}
if(cnt == 0) cout << "-1\n";
else{
int d4 = 0, d7 = 0;
for(int i = 0; i < sz(s); ++i){
if(s[i] == '4') ++d4;
else if(s[i] == '7') ++d7;
}
if(d4 >= d7) cout << "4\n";
else if(d4 < d7) cout << "7\n";
}
return 0;
}