Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.One day Petya was delivered a string s, containing only digits. He needs to find a string that represents a lucky number without leading zeroes, is not empty, is contained in s as a substring the maximum number of times.Among all the strings for which the three conditions given above are fulfilled, Petya only needs the lexicographically minimum one. Find this string for Petya.

The single line contains a non-empty string s whose length can range from 1 to 50, inclusive. The string only contains digits. The string can contain leading zeroes.

In the only line print the answer to Petya's problem. If the sought string does not exist, print "-1" (without quotes).

NoteThe lexicographical comparison of strings is performed by the < operator in the modern programming languages. String x is lexicographically less than string y either if x is a prefix of y, or exists such i (1 ≤ i ≤ min(|x|, |y|)), that xi < yi and for any j (1 ≤ j < i) xj = yj. Here |a| denotes the length of string a.In the first sample three conditions are fulfilled for strings "4", "7" and "47". The lexicographically minimum one is "4".In the second sample s has no substrings which are lucky numbers.In the third sample the three conditions are only fulfilled for string "7".

#include<iostream>
#include<string.h>
#include<stdio.h>
#include<string>

using namespace std;
char ch[1001];
bool ok(int begin,int end,int st,int ed){
     for(int i=begin,j=st;i<=end;i++,j++){
        if(ch[i]!=ch[j]) return false;
     }
    return true;
}
bool check(int st, int ed){
    for(int i=st;i<=ed;i++){
         if(ch[i]!='4' && ch[i]!='7') return false;
    }
    return true;
}
int main(){
    int n;
    while(cin >> ch){
        int ret=0;
        int len=strlen(ch);
        for(int i=0;i<len;i++){
            for(int j=1;i+j-1<len;j++){
                if(!check(i,i+j-1)) continue;
                int cnt=0;
                for(int k=i;k+j-1<len;k++){
                   if(ok(i,i+j-1,k,k+j-1)) cnt++;
                }
                ret=max(ret,cnt);
            }
        }
        if(ret==0) {cout<<"-1";return 0;}
        string ans="8";
        string now;
        for(int i=0;i<len;i++){
            if(ch[i]=='4'||ch[i]=='7'){
                 int j=i;
                 now="";
                 while(j<len && (ch[j]=='4' || ch[j]=='7')){
                      for(int k=i;k<=j;k++)  now+=ch[k];
                      int cnt=0;
                      for(int i2=i,j2=j;j2<len;i2++,j2++){
                         if(ok(i,j,i2,j2))  cnt++;
                      }
                      if(cnt==ret){
                          if(now<ans) ans=now;
                      }
                      j++; now="";
                 }
            }
        }
        if(ans=="8") cout<<"-1";
        else cout<<ans<<endl;
    }
}

#include <iostream>
#include <string>
using namespace std;
bool ishappy (int a)
{
	while (a)
	{
		if (!(a % 10 == 4 || a % 10 == 7))
			return false;
		a /= 10;
	}
	return true;
}
int main()
{
	//freopen ("input.txt","r",stdin);
	string s;
	cin >> s;
	int cnt4 = 0,cnt7 = 0;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == '4')
			cnt4++;
		if (s[i] == '7')
			cnt7++;

	}
	if (cnt4 == 0 && cnt7 == 0)
		puts ("-1");
	else if (cnt4 >= cnt7)
		puts ("4");
	else
		puts ("7");
	return 0;
}

#include<bits/stdc++.h>
#include<iostream>
#include<typeinfo>
#define ll  long long
#define ull unsigned long long
#define ld  long double
#define pb  push_back
#define pf  push_front
#define mp  make_pair
#define all(v)  v.begin(),v.end()
#define BP(n)  __builtin_popcount(n)
#define bs(v,x)  binary_search(all(v),x)
#define lb(v,x) lower_bound(all(v),x) //first equal to or lower than element
#define ub(v,x) upper_bound(all(v),x) //first greater than element
#define rep(i,n)  for(i=0;i<n;i++)
#define rep1(j,n)  for (j=i+1;j<n;j++)
#define Unique(v)  vector<int>::iterator it; sort(all(v)); it= unique(all(v)); v.resize(distance(v.begin(),it))
#define M  1000000007
#define PI  acos(-1.0)
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
using namespace std;
void input(vector<int>& v,int n){ int i,io; rep(i,n) { cin>>io; v.pb(io);} }
void output(vector<int> v) { int i; rep(i,v.size()) cout<<v.at(i)<<" "; }
map<int,int>  frequency(vector<int> v){ int i; map<int,int> m; rep (i,v.size()) {  if (m.find(v[i])==m.end()) m.insert({v.at(i),1}); else m[v.at(i)]++; } return m; }
bool perfsq(ll n){ return (ceil(sqrt(n))==floor(sqrt(n))); }
bool ispower2(int n) { if (n&(n-1)==0) return true; else return false; }
int string_to_int(string s) { stringstream geek(s); long x = 0; geek >> x; return x; }
bool binary_pred(int a,int b){ return a==b; }
void getans() {
	string s;
	cin >> s;
	sort(all(s));
	if (bs(s,'4') == 0 and bs(s,'7') == 0)
		cout<<-1<<endl;
	else {
		int x = count(all(s),'4');
		int y = count(all(s),'7');
		if (x > y)
			cout<<4<<endl;
		else if (x == y)
			cout<<4<<endl;
		else
			cout<<7<<endl;
	}
}
int main() {
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        freopen("error.txt", "w", stderr);
    #endif
    int T = 1;
    //cin >> T;
    while (T--)
        getans();
}
// Check for corner cases
// Check for special case like n = 0 or n = INT_MAX
// Check for Buffer Overflow or use of unsigned variable if any
// Check if problem can be solved mathematically

#include <bits/stdc++.h>
#define ll long long
using namespace std;
map<char,int> m;
string s;

int main()
{
    cin>>s;
   for (int i = 0 ; i < s.size(); i++){
        if (s[i] == '4' || s[i] == '7')
        m[s[i]]++;
   }
   if (m.size() == 0) cout << -1 <<endl;
   else {
    if (m['4'] >= m['7']) cout << 4 <<endl;
    else if (m['4'] < m['7']) cout << 7 <<endl;
   }

    return 0;
}

#include<iostream>
#include<string>
using namespace std;
int main ()
{
	string s , n1 ,n2;
	cin >> s;
	int c=0 , c2=0 ;

	for(int i=0 ; i<s.size() ; i++)
	{

		if(s[i]=='4')
		{
			c++;
			n1=s[i];
		}
		if(s[i]=='7')
		{
			c2++;
			n2=s[i];
		}
	}
	if(c==0 && c2==0)
		cout << -1;
	else if(c>c2)
		cout<< n1;
	else if(c2>c)
		cout << n2;
	else if(c ==c2)
	{
		for(int i=0 ; i<s.size();i++)
		{
			if(s[i]=='4')
			{
				cout << s[i];
				break;
			}

		}

	}

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
bool lucky(int n,int m)
{
    int j=0;
    if(n==0)
    {
        return false;
    }
    while(n!=0)
    {
        if(n%10==4||n%10==7)
        {
            n=n/10;
            j++;
        }
        else
            return false;
    }
    if(j!=m)
    {
        return false;
    }
    return true;
}
int32_t main()
{
    string s;
    cin>>s;
    int n=s.length();
    vector<char> s1;
    map<int,int> m;
    for(int i=0;i<n;i++)
    {
        for(int l=1;l<=n-i;l++)
        {
            int c=0;
            string s1=s.substr(i,l);
            reverse(s1.begin(),s1.end());
            for(int a=0;a<s1.length();a++)
            {
                int x=s1[a]-'0';
                c=c+(x*pow(10,a));
            }
            if(lucky(c,s1.length()))
            {
                m[c]++;
            }
        }
    }
    map<int,int> :: iterator itr;
    int ans=0,p=0;
    for(itr=m.begin();itr!=m.end();itr++)
    {
        if((itr->second)>p)
        {
            ans=itr->first;
            p=itr->second;
        }
    }
    if(ans==0)
    {
        cout<<"-1";
        return 0;
    }
    cout<<ans;
}

#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

int main()
{
    int n=0,a=0,b=0;
    string str;
    cin>>str;
    for(int i=0; i<str.length();i++)
    {
        if(str[i]=='4')
            a++;
        if(str[i]=='7')
            b++;
    }
    if(a==0 && b==0)
        cout<<"-1";
    else
        if(a>=b)
            cout<<"4";
        else
            cout<<"7";
    return 0;
}

#include<stdlib.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main()
{
    char s[51];
    int cnt1=0,cnt2=0,f=0,i,l;
    scanf("%s",&s);
    l=strlen(s);
    for(i=0;i<l;i++)
    {
        if(s[i]=='4') cnt1++;
        if(s[i]=='7') cnt2++;
    }
    if(cnt1==0 && cnt2==0) {printf("-1\n"); return 0;}

    if(cnt1>=cnt2) printf("4\n");
    else printf("7\n");
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
string s;cin>>s;
int A[10]={};
for(int i=0;i<s.size();i++)
    A[s[i]-'0']++;
if(!A[7]&&!A[4])
    cout<<-1<<endl;
else if(A[7]>A[4])
    cout<<7;
else
    cout<<4;

return 0;}

#include <iostream>
using namespace std;
int main()
{string str;int counter4 = 0 , counter7 = 0;cin >> str;for (int i = 0 ; i < str.length() ; i++){if(str[i] - '0' == 4){counter4++;}else if(str[i] - '0' == 7){counter7++;}}
    if (counter7 > counter4){cout << 7;}else if (counter4 != 0){cout << 4;}else {cout << -1;}return 0;}

#include <stdio.h>
#include <string.h>

int main()
{
    int ans4 = 0, ans7 = 0;
    char str[100];
    scanf("%s", str);
    int len = strlen(str);
    for(int i = 0; i < len; ++i)
        if(str[i] == '4')
            ans4++;
        else if(str[i] == '7')
            ans7++;
    if(!ans4 && !ans7)
        printf("-1\n");
    else if(ans7 > ans4)
        printf("7\n");
    else printf("4\n");
    return 0;
}

#include <iostream>
#include <string>
#include<vector>
#include <algorithm>
#include<map>

using namespace std;

int main()
{
    string s;
    cin>>s;
    int four=0,seven=0;
    for (int i=0;i<s.size();i++)
    {
        if (s[i]=='4')
            four++;
        if (s[i]=='7')
            seven++;
    }
    if (four+seven>0)
    {
        if (four>=seven)
            cout<<4;
        else if (four<seven)
            cout<<7;
    }
    else
        cout<<-1;
}
/* Fri Nov 01 2019 20:08:31 GMT+0300 (MSK) */

/* Fri Nov 01 2019 20:14:14 GMT+0300 (MSK) */

/* Fri Nov 01 2019 20:17:52 GMT+0300 (MSK) */

#include <algorithm>
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#define ll long long
using namespace std;

int main()
{
	string s;
	int a = 0, b = 0;
	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == '4')
			a++;
		else if (s[i] == '7')
			b++;
	}
	if (b > a)
		cout << "7";
	else if (a == 0)
		cout << "-1";
	else
		cout << "4";
}

/* Fri Nov 01 2019 20:04:49 GMT+0300 (MSK) */

/* Fri Nov 01 2019 20:07:50 GMT+0300 (MSK) */

/* Fri Nov 01 2019 20:11:02 GMT+0300 (MSK) */

#include <stdio.h>
#include <string.h>
int main()
{
	char s[51];
	while(scanf("%s",s)!=EOF)
	{
		int sum1=0;
		int sum2=0;
		for(int i=0;i<strlen(s);i++)
		{
			if(s[i]=='4')
			sum1++;
			if(s[i]=='7')
			sum2++;
		}
		if(sum1==0&&sum2==0)
		{
			printf("-1\n");
			continue;
		}
	    if(sum1>=sum2)
	    {
	    	printf("4\n");
		}
		else
		printf("7\n");
	}
}

#include<bits/stdc++.h>
using namespace std;

string s;

int main()
{
	cin >> s;
	int cnt4 = 0, cnt7 = 0;
	for(int i = 0; i < s.size(); ++ i)
	{
		if(s[i] == '4')
			cnt4 ++;
		else if(s[i] == '7')
			cnt7 ++;
	}
	if(!max(cnt4, cnt7))
		cout << -1 << endl;
	else if(cnt4 >= cnt7)
		cout << 4 << endl;
	else
		cout << 7 << endl;
	return 0;
}

#include <string>
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;

string t;
int n,i,x,q,mek,erku;

int a[15]={4,7,44,47,74,77,444,447,474,477,744,747,774,777};

int main()
{
//      freopen(file".in","r",stdin);
//      freopen(file".out","w",stdout);
        cin>>t;
        x=t.length();
		for(i=0;i<x;i++)
		{
			if(t[i]=='4')
			{
				mek++;
				q++;
			}
			if(t[i]=='7')
			{
				erku++;
				q++;
			}
		}
		if(q==0)
		{
			cout<<-1<<endl;
			return 0;
		}
		if(mek>=erku)
		{
			cout<<4<<endl;
			return 0;
		}
		else
		{
			cout<<7<<endl;
			return 0;
		}
		return 0;
}

#include<bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define repa(i,a,n) for(int i=a;i<n;i++)
using namespace std;
char s[50];
int f=0,se=0;
int main()
{
    FIO;
    cin>>s;
    int n=strlen(s);
    repa(i,0,n){
      if(s[i]=='4')f++;
      if(s[i]=='7')se++;
    }
    if(f==0&&se==0){cout<<"-1"<<endl;return 0;}
    if(f>=se)cout<<'4'<<endl;
    if(se>f)cout<<'7'<<endl;
    return 0;
}

#include<stdio.h>
#include<cmath>
#include<algorithm>
#include<string>
#include<string.h>
#include<cstdlib>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<vector>
#include<iostream>
using namespace std;
int main(){
	string s;
	cin>>s;
	int hush[10]={0};
	int len=s.length();
	for(int i=0;i<len;i++){
		hush[s[i]-'0']++;
	}
	if(hush[4]==0&&hush[7]==0) printf("-1\n");
	else if(hush[4]>=hush[7]) printf("4\n");
	else printf("7\n");
	return 0;
}

// #pragma GCC optimize("no-stack-protector")
// #pragma GCC diagnostic ignored "-W"

#include<cassert>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<sstream>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<vector>
#include<utility>

// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace __gnu_pbds;

#define ll long long
#define ld long double
#define X first
#define Y second
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vint vector<int>
#define SS stringstream
#define PQ priority_queue
#define PRF(...) printf(__VA_ARGS__)
#define MS(x,v) memset((x),(v),sizeof(x))
#define RZUNI(x) sort(x.begin(),x.end()), x.resize(unique(x.begin(),x.end())-x.begin())
#define FLH fflush(stdout)
#define CPPinput ios_base::sync_with_stdio(0); cin.tie(0)

#define tm Ovuvuevuevue
#define y1 Enyetuenwuevue
#define left Ugbemugbem
#define ws Osas
#define dec tetteterette
#define exp expexpexpexp
#define expl explexplexpl

#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl

#ifdef WEAK
#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL_((0,__VA_ARGS__,5,4,3,2,1))
#define VA_NUM_ARGS_IMPL_(tuple) VA_NUM_ARGS_IMPL tuple
#define VA_NUM_ARGS_IMPL(_0,_1,_2,_3,_4,_5,N,...) N
#define macro_dispatcher(macro, ...) macro_dispatcher_(macro, VA_NUM_ARGS(__VA_ARGS__))
#define macro_dispatcher_(macro, nargs) macro_dispatcher__(macro, nargs)
#define macro_dispatcher__(macro, nargs) macro_dispatcher___(macro, nargs)
#define macro_dispatcher___(macro, nargs) macro ## nargs
#define PDE1(a) cout<<#a<<" = "<<(a)<<endl
#define PDE2(a,b) cout<<#a<<" = "<<(a)<<" , ", PDE1(b)
#define PDE3(a,b,c) cout<<#a<<" = "<<(a)<<" , ", PDE2(b,c)
#define PDE4(a,b,c,d) cout<<#a<<" = "<<(a)<<" , ", PDE3(b,c,d)
#define PDE5(a,b,c,d,e) cout<<#a<<" = "<<(a)<<" , ", PDE4(b,c,d,e)
#define PDE(...) macro_dispatcher(PDE, __VA_ARGS__)(__VA_ARGS__)
#define DEB(...) printf(__VA_ARGS__),fflush(stdout)
#define WHR() printf("%s: Line %d",__PRETTY_FUNCTION__,__LINE__),fflush(stdout)
#define LOG(...) printf("%s: Line %d ",__PRETTY_FUNCTION__,__LINE__),printf(__VA_ARGS__),fflush(stdout)
#define FIN freopen("in","r",stdin)
#define FOUT freopen("out","w",stdout)
#define DEBUG 1
#define exit(x) cout<<"exit code "<<x<<endl, exit(0)
#else
#define PDE(...) ;
#define PDE1(a) ;
#define PDE2(a,b) ;
#define PDE3(a,b,c) ;
#define PDE4(a,b,c,d) ;
#define PDE5(a,b,c,d,e) ;
#define DEB(...) ;
#define WHR() ;
#define LOG(...) ;
#define getchar gtx
#define FIN ;
#define FOUT ;
#define DEBUG 0
#endif

#define lowbit(x) ((x)&(-(x)))

#if __cplusplus >= 201103L
#include<unordered_map>
#include<unordered_set>
#include<tuple>

template<typename TA,typename TB> ostream& operator<<(ostream& ostm, const pair<TA,TB> &p){ostm<<"("<<p.X<<","<<p.Y<<")";return ostm;}
template<typename T> ostream& operator<<(ostream &ostm, const vector<T> &v){ostm<<"[ ";for(auto i:v)ostm<<i<<" ";ostm<<"]";return ostm;}
template<typename TA,typename TB> ostream& operator<<(ostream &ostm, const map<TA,TB> &mp){ostm<<"[ ";for(auto &it:mp)ostm<<it<<" ";ostm<<"]";return ostm;}
template<typename T> ostream& operator<<(ostream &ostm,const set<T> &s){ostm<<"[ ";for(auto &it:s)ostm<<it<<" ";ostm<<"]";return ostm;}
template<typename T> ostream& operator<<(ostream &ostm,const multiset<T> &s){ostm<<"[ ";for(auto &it:s)ostm<<it<<" ";ostm<<"]";return ostm;}
template<typename T> ostream& operator<<(ostream &ostm,const stack<T> &inp){stack<T> st=inp;ostm<<"[ ";while(!st.empty()){ostm<<st.top()<<" ";st.pop();}ostm<<"]";return ostm;}
template<typename T> ostream& operator<<(ostream &ostm,const queue<T> &inp){queue<T> q=inp;ostm<<"[ ";while(!q.empty()){ostm<<q.front()<<" ";q.pop();}ostm<<"]";return ostm;}
template<typename TA,typename TB,typename TC> ostream& operator<<(ostream &ostm,const priority_queue<TA,TB,TC> &inp){priority_queue<TA,TB,TC> pq=inp;ostm<<"[ ";while(!pq.empty()){ostm<<pq.top()<<" ";pq.pop();}ostm<<"]";return ostm;}
template<typename T> ostream& operator<<(ostream &ostm,const deque<T> &inp){deque<T> dq=inp;ostm<<"[ ";while(!dq.empty()){ostm<<dq.front()<<" ";dq.pop_front();}ostm<<"]";return ostm;}
// ostream& operator<<(ostream &ostm,const __int128 &val){if(!val){ostm<<"0"; return ostm;} bool mns=0; __int128 cpy=(val<0?mns=1,-val:val); stack<char> st; while(cpy)st.push(cpy%10+'0'),cpy/=10; if(mns)st.push('-'); while(st.size())ostm<<st.top(),st.pop(); return ostm;}
#endif

void JIZZ(){cout<<"";exit(0);}

const ld PI=3.14159265358979323846264338327950288;
const ld eps=1e-13;
const ll mod=1e9+7;

int solv(string &s,string t){
PDE(s,t);
    int cnt=0;
    for(int i=0;i<s.size();++i){
        if(i+t.size()-1>=s.size())continue;
        bool ok=1;
        for(int j=0;j<t.size();++j){
            PDE(s[i+j],t[j]);
            if(s[i+j]!=t[j])ok=0;
        }
        if(ok)++cnt;
    }
    return cnt;
}

int main(){
    CPPinput;
    string s; cin>>s;
    int mxt=0;
    string ans;
    for(int i=0;i<s.size();++i){
        if(s[i]=='0')continue;
        for(int j=i;j<s.size();++j){
            if(s[j]!='4' && s[j]!='7')break;
            int t=solv(s,s.substr(i,j-i+1));
            PDE(t);
            if(t>mxt){
                mxt=t;
                ans=s.substr(i,j-i+1);
            }
            else if(t==mxt){
                ans=min(ans,s.substr(i,j-i+1));
            }
        }
    }
    if(ans=="")cout<<-1<<endl;
    else cout<<ans<<endl;
}

#include<iostream>
#include<string>
using namespace std;

int main()
{
 int n;
 int k=0,l=0;
 string s;
 cin>>s;
 n=s.length();
 for(int i=0; i<n; i++){
  if (s[i]=='4') k++;
 else
  if (s[i]=='7') l++;}

  if (k==0 && l==0) cout<<"-1"; else

  if (k>=l)
   cout<<4; else

 if (l>k)
   cout<<7;
  // system("pause");
    return 0;
}

#include <cstdio>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <cstring>

using namespace std;

#define MAXN 1000
#define INF 1000000000
char s[MAXN];
string s1;
vector < string > a;
int main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    gets(s);
    string s1 = string(s);
    int N = strlen(s);
    for (int i = 0; i < N; i++)
    {
        string s0 = "";
        if (s[i] == '4' || s[i] == '7')
        {
            s0 = s[i];
            a.push_back(s0);
        }
        else
            continue;
        for (int j = i + 1; j < N; j++)
        {
            if (s[j] == '4' || s[j] == '7')
            {
                s0 += s[j];
                a.push_back(s0);
            }
            else
                break;
        }
    }
    int ans = 0;
    string sans = "";
    sort(a.begin(), a.end());
    a.push_back("");
    int p = 1;
    for (int i = 0; i < a.size() - 1; i++)
        if (a[i] == a[i + 1])
            p++;
        else
        {
            if (p > ans)
            {
                ans = p;
                sans = a[i];
            }
            else if (p == ans && a[i] < sans)
            {
                sans = ans;
            }
            p = 1;
        }
    if (sans == "")
        cout << -1 << endl;
    else
        cout << sans << endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
void solve()
{

   string s;
   cin>>s;
   int l=s.length();
   int freq[10]={0};
   for(int i=0;i<l;i++)
    {
    int k=s[i]-'0';
    if(k==4 || k==7){
        if(k==4){
            freq[4]++;
        }
        else{
            freq[7]++;
        }
    }
    }
    if(freq[4]==0 && freq[7]==0){
        cout<<-1;
        return;
    }
   if(freq[7] >freq[4] ){
       cout<<7;
       return;
   }
   else{
       cout<<4;
       return;
   }
}
int main()
{
	 solve();
}

#include<iostream>
#include<string.h>
#include<stdio.h>
#include<string>

using namespace std;
char ch[1001];

int main(){
    int n;
    while(cin >> ch){
       int c4=0,c7=0;
       for(int i=0;ch[i];i++) {
           if(ch[i]=='4') c4++;
           if(ch[i]=='7') c7++;
       }
       if(c4==0 && c7==0) cout<<-1;
       else if(c4>=c7) cout<<4;
       else cout<<7;
    }
}

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <random>
using namespace std;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    string s;
    cin >> s;

    int k4 = count(s.begin(), s.end(), '4');
    int k7 = count(s.begin(), s.end(), '7');

    if (!k4 && !k7) {
        cout << -1;
    } else if (k4 >= k7) {
        cout << 4;
    } else {
        cout << 7;
    }
}

#include <iostream>
#include <cmath>
#include <math.h>
#include<string>
#include<algorithm>
#include<vector>
#define forl(i,x) for(int i = 0; i < x; i++)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
int counter = 0;
vector <string> v;
int index = 0;
bool p = false;

int power(int num,int x){
	int result = 1;
	forl(i,x)
		result*=num;
	return result;
}
int main(){
	string c;
	cin>>c;
	int f = 0;
	bool w ;
	int s = 0;
	forl(i,c.size()){
		if(c[i]=='4'){
			f++;
			w = false;
		}
		else if(c[i]=='7'){
			s++;
			w = true;
		}
	}
	if(s==0&&f==0)
		cout<<-1<<endl;
	else{
		if(f>=s)
			cout<<'4'<<endl;
		else if(s>f)
			cout<<'7'<<endl;
	}
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
    string str;
    cin>>str;

    int four=0;
    int seven=0;

    for(int i=0 ; i<str.size() ; i++)
    {
        char curr = str[i];
        if(curr=='4')
        four++;
        else if(curr=='7')
        seven++;
    }
    if(four >= seven && four!=0)
    cout << '4';
    else if(seven > four)
    cout << '7';
    else
    cout << "-1";
}

/*-------------------------------------------*\
 * @ mdjobayairhossain2020
 * Author : MD. JOBAYAIR HOSSAIN
 * Created: June/24/2020    21:06:17(UTC+6)
-*-------------------------------------------*/
#include <bits/stdc++.h>
using namespace std;

int main()
{   ios_base::sync_with_stdio(false);
    cin.tie(0);

    //Here, the possible outputs can be: 4 or 7 or -1.  (4 or 7) is the minimum digit of a lucky number.
   //So, 4 or 7 should stay as the substring as the maximum number of times in the whole String.

    string S;
    cin>>S;

    int Count_4 = 0, Count_7 = 0;

    for(int i=0; i<S.size(); i++){
        if(S[i] == '4'){
            Count_4++;
        }
        else{
            if(S[i] == '7'){
                Count_7++;
            }
        }
    }

    if(Count_4 == 0 && Count_7 == 0){
        cout<<-1<<"\n";
    }
    else{
        if(Count_4 >= Count_7){
            cout<<4<<"\n";
        }
        else{
            cout<<7<<"\n";
        }
    }

    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
string s;
cin>>s;
int c4 = count (begin(s), end(s), '4');
int c7 = count (begin(s), end(s), '7');
if (c4>=c7 && c4>0)
{
    cout<<"4";
    return 0;
}
else
{
    if (c7>0)
    {
        cout<<"7";
        return 0;
    }
}
cout<<"-1";
}

/* Fri Nov 01 2019 20:52:08 GMT+0300 (MSK) */

/****************************************
**     by VISHAL TEKWANI               **
****************************************/

#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define F first
#define S second
#define MP make_pair
#define sqr(a) (a)*(a)
#define all(x) (x).begin(), (x).end()
#define for0(i, n) for (ll i = 0; i < n; i++)
#define for1(i, n) for (ll i = 1; i <= n; i++)
#define loop(i,a,b) for (ll i = a; i < b; i++)
#define bloop(i,a,b) for (ll i = a ; i>=b;i--)
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define cases ll t;cin >> t;while(t--)
#define rr return 0
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const int MOD = 1000 * 1000 * 1000 + 7;

int main()
{
    fast;
    ll f=0,s=0,tmp;
    string n;
    cin >> n;
    for0(i, n.length())
    {
        if (n[i] == '4')
            f++;
        else if (n[i] == '7')
            s++;
    }
    if (f == 0 && s == 0)
        cout << -1;
    else
    {
        //cout << f << " " << s << "\n";
        if (f >= s)
            cout << 4;
        else
            cout << 7;
    }
    return 0;
}

#include <cstdio>

char str_[51];

int main() {
  std::scanf("%s", str_);

  int count4 = 0, count7 = 0;
  for (int i = 0; str_[i]; ++i) {
    if (str_[i] == '4') ++count4;
    if (str_[i] == '7') ++count7;
  }
  std::printf("%d\n", count4 == 0 && count7 == 0 ? -1 : count4 >= count7 ? 4 : 7);
  return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define rep(i, v)       for(int i=0;i<sz(v);++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define all(v)              ((v).begin()), ((v).end())
#define sz(v)               ((int)((v).size()))
#define clr(v, d)           memset(v, d, sizeof(v))
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
const ll OO = 1e8;

const double EPS = (1e-7);
int dcmp(double x, double y) {  return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;   }

#define pb                  push_back
#define MP                  make_pair
#define P(x)                cout<<#x<<" = { "<<x<<" }\n"
typedef long double       ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef vector<pair<int, int> > vii;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;

#define FilesX

const int N = 100;
int LuckySubstring();
int main()
{
#ifdef Files
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false);

    LuckySubstring();

    return 0;
}

int LuckySubstring()
{
#ifdef Files
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false);

    string s; cin >> s;
    int four = 0, seven = 0;
    lp(i, s.size()){
        if(s[i] == '4') four++;
        else if(s[i] == '7') seven++;
    }
    if(four == 0 && seven == 0) cout << -1 << endl;
    else if(four >= seven) cout << 4 << endl;
    else cout << 7 << endl;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;

int countFreq(string &pat, string &txt)
{
    int M = pat.length();
    int N = txt.length();
    int res = 0;

    for (int i = 0; i <= N - M; i++)
    {
        int j;
        for (j = 0; j < M; j++)
            if (txt[i+j] != pat[j]) break;

        if (j == M)
        {
           res++;
           j = 0;
        }
    }
    return res;
}

bool isLucky(string str){
    if(str.find('0') != string::npos) return false;

    int len = str.length();

    for(int i=0;i<len;++i){
        char c = str[i];
        if(c != '4' && c != '7') return false;
    }

    return true;
}

int main() {

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    string str;
    cin>>str;

    vector<string> vec;
    vec.clear();

    int len = str.length();

    for(int i=0;i<len;++i){
        for(int j=i;j<len;++j){
            string s = "";
            for(int k=i;k<=j;++k){
                s += str[k];
            }
            vec.push_back(s);
        }
    }

    vector<string> lucky;
    lucky.clear();

    for(auto ele : vec){
        if(isLucky(ele)) lucky.push_back(ele);
    }

    if(!lucky.size()){
        cout<<-1;
        return 0;
    }

    int globalCnt = 0;

    map<string,int> Map;

    vector<string> ans;
    ans.clear();

    for(auto ele : lucky){

        int cnt = countFreq(ele,str);

        Map[ele] = cnt;

        globalCnt = max(globalCnt,cnt);

    }

    for(auto ele : Map){
        if(ele.second == globalCnt){
            cout<<ele.first;
            return 0;
        }
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll x=0,y=0;
    string s;
    cin>>s;
    for(ll i=0;i<s.length();i++){
        if(s[i]=='4') x++;
        if(s[i]=='7') y++;
    }
    if(x>=y){
        if(x!=0) cout<<"4\n";
        else cout<<"-1\n";
    } else cout<<"7\n";
    return 0;
}

#include<iostream>
#include<cstdio>
using namespace std;

int main()
{
    int i=0,j=0,k,max;
    char str[1000];
    cin>>str;
    for(k=0;str[k];k++)
    {
        if (str[k]=='4') i++;
        if(str[k]=='7') j++;
    }
    max=i>=j? i:j;
    if(max==0) cout<<-1;
    if(i>=j && i)
    {
        cout<<4;
    }
    if(j>i) cout<<7;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,cnt=0,check=0;
    string str;
    cin>>str;
    for(i=0;i<str.size();i++)
    {
        if(str[i]=='4')
        {
            check=1;
            cnt++;
        }else if(str[i]=='7')
        {
            cnt--;
            check=1;
        }

    }
    if(check==1){
        if(cnt>=0)
            cout<<"4"<<endl;
        else
            cout<<"7"<<endl;
    }
    else
            cout<<"-1"<<endl;
}

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

#define ull unsigned long long
#define pr 31

bool hash_comp(pair < ull, int > a, pair < ull, int > b)
{
	if(a.first < b.first)
		return true;
	return false;
}

int main()
{
	char S[51];
	int S2[51];
	cin >> S;
	int len = strlen(S);

	int max_count = 1;
	int max_len = 1;
	vector < int > ans;
	bool any = 0;
	for(int i=0;i<len;i++)
	{
		if((S[i]-'0')==7||(S[i]-'0')==4)
		{
			any = true;

			if(ans.size()==0)
				ans.push_back(i);
		}
	}
	if(!any)
	{
		cout << -1;
		return 0;
	}

	vector < pair <ull,int> > hash;

	for(int i=1;i<=len;i++)
	{
		ull H = 0;
		bool good;
		hash.clear();
		for(int j=0;j<=len-i;j++)
		{
			good = 1;
			H = 0;
			for(int k=0;k<i;k++)
			{
				H = H*pr + (S[j+k]-'0');
				if((S[j+k]-'0')!=4&&(S[j+k]-'0')!=7)
					good = 0;
			}
			if(good)
			{
				hash.push_back(pair < ull,int >(H,j));
			}
		}
		sort(hash.begin(),hash.begin()+hash.size());
		int group_len = 1;
		int l=1;
		do
		{
			if(l>=hash.size())
				break;
			while(l<hash.size()&&hash[l].first==hash[l-1].first)
			{
				l++;
				group_len++;
			}
			if(group_len==max_count)
			{
				ans.push_back(hash[l-1].second);
			}
			if(group_len>max_count)
			{
				ans.clear();
				ans.push_back(hash[l-1].second);
				max_count = group_len;
				max_len = i;
			}
			l++;
			group_len = 1;
		}while(l<hash.size());
	}

	int min_str = ans[0];

	for(int i=1;i<ans.size();i++)
	{
		if(lexicographical_compare(&S[ans[i]],&S[ans[i]+max_len],&S[min_str],&S[min_str+max_len]))
			min_str = ans[i];
	}

	for(int i=0;i<max_len;i++)
	{
		cout << S[min_str+i];
	}

	cout << '\n';

	return 0;
}

#include <iostream>
#include <string>

using namespace std;

int main(){
	string s;
	cin >> s;
	int l = s.length();

	int c4=0;
	int c7=0;

	for(int i=0;i<l;i++)
		if(s[i]=='4') c4++;
		else if(s[i]=='7') c7++;

	if (!c4 && !c7) {
		cout << -1;
	}else if (c7>c4){
		cout << 7;
	}else{
		cout << 4;
	}

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
main() {

    string s;
    getline(cin, s);
    vector<int> cnt(200);
    for (char i : s)
        cnt[i]++;

    if (cnt['4'] >= max(1, cnt['7'])) printf("4"); else
    if (cnt['7']) printf("7");
        else printf("-1");
    return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<fstream>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<queue>
#include<map>
#include<string>
#include<stack>
#include<vector>
#include<set>
#include<iomanip>

using namespace std;
#define int long long
#define fi(i,a,b) for(int i = a; i < (b); i++)

	char c;
	int i, seven, four;
	string str;

void main() {
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	cin >> str;

	//while(c != '\n')
	//{
	//
	//	if (c != '\n')
	//	str[i] = c;
	//	i++;
	//}

	for(int j = 0; j<str.size(); j++)
	{
		if(str[j] == '4')
			four++;
		if(str[j] == '7')
			seven++;
	}
	if(seven == 0 && four == 0)
		cout<< -1;
	else if(seven>four)
			cout << 7;
		else cout << 4;
}

//abo  masteriiiiii
#include<iostream>
using namespace std;
int main(){
    int k=0,l=0;
    string a;
    cin>>a;
    for(int i=0;i<a.size();i++)
                        {
        if(a[i]=='7')
            l++;
        else if(a[i]=='4')
            k++;
                     }
           if((k==0) && (l==0))
                      {
           cout<<-1<<endl;
             return 0;
                        }
            if(k==l)
            {
            cout<<4<<endl;
            return 0;
            }
        if(k>l)  {
            cout<<4<<endl;
            return 0;
                 }
        if(k<l)
                {

            cout<<7<<endl;
            return 0;
                   }
     else   cout<<-1<<endl;
       //system("pause");
}

#include<bits/stdc++.h>
#define AmrYassen    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define F first
#define S second
#define pii pair<int ,int>
#define pll pair<ll , ll>
#define pb push_back
#define pf push_front
#define p push
#define pi 3.14159265358979323846;
#define loop(i, l, r) for (int i = (l); i <(r); i++)
#define pobb pop_back
#define pobf pop_front
typedef long long ll;
typedef unsigned long long ull;
int  const N = 1e6 * 2;
using namespace std;
ll n,i,y,a,maxx; string s,ss,minn;
map<string,ll>m; bool isfound,isfound2;
int main()
{   AmrYassen
    cin>>s;
    minn="9";
    for(int i=0; i<s.length(); i++)
    {   if(s[i]=='4')
        {   isfound=true;
            m["4"]++;
            ss+=s[i]; }
        if(s[i]=='7')
        {   isfound2=true;
            m["7"]++;
            ss+=s[i]; }
        if(s[i]!='7' && s[i]!='4')
        {   ss.erase(0,ss.length());
            isfound=false;
            isfound2=false; }
        if(isfound&&isfound2)
        {   m[ss]++; } }
    map<string,ll>::iterator it;
    for(it=m.begin(); it!=m.end(); it++)
    {   maxx=max(maxx,it->S); }
    for(it=m.begin(); it!=m.end(); it++)
    {   if(it->S==maxx)
        {   minn=min(minn,it->F); } }
    if(minn=="9")
        return cout<<"-1",0;
    cout<<minn;
    return 0; }

#include "iostream"
#include "string"
#include "cstring"
#include "vector"
#include "set"
#include "algorithm"

#define FOR(i,n,s) for(int (i)=0;(i)<(n);(i)+=(s))
using namespace std;

vector<int> list;
bool is_lucky(int n){
    while(n!=0){
        if((n%10!=4 && n%10!=7 )|| n<4)
            return false;
        n/=10;
    }
    return true;
}
void make_q(int n){
    int i=2;
    while(i<=n){
        if(n%i==0){
            list.push_back(i);
            list.push_back(n/i);

            }

        i++;
    }
}
int max(int d[]){
    int s=0,i=0;
    FOR(j,10,1){
        if(d[j]>s){
            s=d[j];
            i=j;
        }
    }
    return s;
}

int main(){
    char str[60];
    cin>>str;
    int dig[10];

    int len=strlen(str);
    FOR(i,10,1){
        dig[i]=0;
    }
    FOR(i,len,1){
        dig[str[i]-'0']++;
    }

    if(dig[4]!=0)
        if(dig[4]>=dig[7])
            cout<<4;
        else
            cout<<7;
    else if(dig[7]!=0)
            cout<<7;
    else
        cout<<-1;
    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <cmath>
#define f(i,x,n) for(int i = x;i < n;i++)
#define ll long long int
#define co(x)  cout << x << endl;
#define ci(x) cin >> x;
#define p(x) printf("%d\n",x);
#define s(x) scanf("%d",&x);
#define e() cout << endl;
#define MAX_INT INT;
#define cp(x,y) cout << "Case : " << x << " " << y << endl;
using namespace std;
int main()
{
	string s;
	cin >> s;
	int x = 0,y = 0;
	for(char c : s)
		x += c == '4',y += c == '7';
	if(!x && !y)
		cout << "-1\n";
	else if(x >= y)
		cout << "4\n";
	else
		cout << "7\n";
}

#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	int c=0,w=0;
	string x;
	cin>>x;
	for(int i=0;i<x.length();i++){
	if(x[i]=='7')
	 	c++;
    if(x[i]=='4')
		w++;
	}
if(c>w)
	cout<<'7'<<endl;
else{
	if(c==w&&c!=0&&w!=0){
		int y=x.find('7');
		int z=x.find('4');
		//if(y>z)
		cout<<'4'<<endl;
		//else
		//cout<<'7'<<endl;
	}
	else{
		if(w>c)
	 	cout<<'4'<<endl;
		else
			cout<<-1;

	}

}
}

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <math.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	string s;
	cin >> s;

	int has4 = 0, has7 = 0;
	for (auto ch : s) {
		if (ch == '4') has4++;
		if (ch == '7') has7++;
	}

	if ((has4 + has7 == 0)) cout << "-1\n";
	else if (has4 >= has7) cout << "4\n";
	else if (has7) cout << "7\n";

	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
string s;
cin>>s;
if(s.find("4")==string::npos &&s.find("7")==string::npos)
return 0&puts("-1");
cout<<(count(s.begin(),s.end(),'4')>=
count(s.begin(),s.end(),'7')?4:7)
<<"\n";
}

#include <bits/stdc++.h>
#define pi acos(-1)
#define sz(x) (int) x.size()
#define pii pair<int, int>
#define mii map<int, int>
#define vi vector<int>
#define vb vector<bool>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define popb pop_back
#define all(v) v.begin(),v.end()
#define mset(v, x) memset(v, x, sizeof(v))
#define mset2d(v, x, n) memset(v, x, sizeof(v[0][0]) * n * n)
#define mset2dd(v, x, n, m) memset(v, x, sizeof(v[0][0]) * n * m)
#define debug(x) cout<<#x<<" : "<<x<<endl
#define debug2(x,y) cout<<#x<<" : "<<x<<" & "<<#y<<" : "<<y<<endl
#define test() cout<<"hola papa"<<endl
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
using namespace std;

bool islucky(string s) {
    for (int i = 0; i < sz(s); ++i) {
        if (s[i] != '4' && s[i] != '7') return 0;
    }
    return 1;
}

int cont(string p, string s) {
    int cnt = 0;
    for (int i = 0; i + sz(p) - 1 < sz(s); ++i) {
        string aux = s.substr(i, sz(p));
        if (p == aux) ++cnt;
    }
    return cnt;
}

string solve(string s) {
    int aux = -1;
    string ans;
    for (int i = 0; i < sz(s); ++i) {
        for (int j = 1; j < sz(s) - i + 1; ++j) {
            string saux = s.substr(i, j);
            if (islucky(saux)) {
                int caux = cont(saux, s);
                if (caux > aux) {
                    aux = caux;
                    ans = saux;
                } else if (caux == aux) {
                    if (saux < ans) {
                        aux = caux;
                        ans = saux;
                    }
                }
            }
        }
    }
    if (aux < 0) return "-1";
    return ans;
}

string s;

int main() {
    cin >> s;
    cout << solve(s) << "\n";
}

#include <stdio.h>
#include <iostream>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <queue>
//#include <map>
using namespace std;
#define ll long long
#define pi acos(-1)
ll n, m, k = 1;

int main()
{
    int i, j, z;
    //char s[100005];
    vector<int> v;
    int k = 0;
    char s[100];
    //int a[100] ={4,7,47,74,444,447,474,477,744,747,774,777};
    int t;
    while(cin >> s)
    {
        int flag = 1;
        int k1= 0, k2 = 0;
        for(i = 0;i < strlen(s); i++)
        {
            if(s[i] == '4')
                k1++;
            else if(s[i] == '7')
                k2++;
        }
        if(!k2 && !k1)
        {
            puts("-1");
        }
        else
        {
            if(k1 >= k2)
                puts("4");
            else
                puts("7");
        }
    }
    return 0;
}

# include <bits/stdc++.h>

# define fi first
# define se second
# define mp make_pair
# define INF 100000000000

using namespace std;

typedef long long ll;

bool is_hap(string a)
{
    for(ll i=0;i<a.size();i++)
        if (a[i]!='4'&&a[i]!='7')
            return false;
    return true;
}
ll num(string z,string a)
{
    ll res=0;
    for(ll i=0;i<=z.size()-a.size();i++)
    {
        string cur=z.substr(i,a.size());
        if (cur==a)
            ++res;
    }
    return res;
}
int main()
{
    string a,ans="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz";
    cin>>a;
    ll maxx=-INF;
    for(ll i=0;i<a.size();i++)
        for(ll j=1;j<=a.size()-i;j++)
        {
            string cur=a.substr(i,j);
            if (cur[0]!='0'&&is_hap(cur)==1)
            {
                maxx=max(maxx,num(a,cur));

            }
        }
    for(ll i=0;i<a.size();i++)
        for(ll j=1;j<=a.size()-i;j++)
        {
            string cur=a.substr(i,j);
            if (cur[0]!='0'&&is_hap(cur)==1&&num(a,cur)>=maxx)
            {
                ans=(ans<cur?ans:cur);
            }
        }
    cout<<(maxx==-INF?"-1":ans);
    return 0;

}

#include<iostream>
#include<string>
using namespace std;
int main()
{ string s;
int a=0,b=0;
cin>>s;
for(int i=0;i<s.size();++i)
{
    if(s[i]=='7')
        ++b;
    if(s[i]=='4')
        ++a;
}
if(b==0 && a==0)
    cout<<-1;
else if(b==a)
    cout<<4;
else if(b>a)
    cout<<7;
else
    cout<<4<<endl;

    return 0;}

#include<bits/stdc++.h>
using namespace std;

int main()
{
	string s;
	cin>>s;
	int c=0,c1=0,j,k;
    for(int i=0;i<s.size();i++)
    {
    	if(s[i]=='4'){
    	c++;
    	if( c==1)
    	j=i;

    	}
    	if(s[i]=='7'){
    	c1++;
    	if( c1==1)
    	k=i;
    	}

     }

     if(c==0 && c1==0){
     cout<<"-1";
     return 0;
     }
     if(c>=c1)
     cout<<"4";
     else if(c<c1)
     cout<<"7";

     return 0;

}

#include <iostream>
#include <string>
using namespace std;
int main()
{
	int i, k1=0, k2=0;
	string s;
	cin>>s;
	for(i=0; i<s.length(); i++)
	{
		if(s[i]=='4')
			k1++;
		if(s[i]=='7')
			k2++;
	}
	if(k1||k2)
		if(k2>k1)
			cout<<"7";
		else
			cout<<"4";
	else
		cout<<"-1";
	return 0;
}

// by shik
#include <cstdio>
#include <cstring>
#include <algorithm>
#define FOR(it,c) for ( __typeof((c).begin()) it=(c).begin(); it!=(c).end(); it++ )
using namespace std;
int main()
{
	char s[100];
	gets(s);
	int cnt[10]={};
	for ( int i=0; s[i]; i++ ) cnt[s[i]-'0']++;
	if ( cnt[4]==0 && cnt[7]==0 ) puts("-1");
	else if ( cnt[4]>=cnt[7] ) puts("4");
	else puts("7");
	return 0;
}

#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  re0 x=0,f=1;rec c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
inline void read(rel &x){
  x=0;re0 f=1;rec c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  x=f?x:-x;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return pc(48);
  if (x<0) x=-x,pc('-');
  re0 bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  }
inline char fuhao(){
  rec c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
string s;

int is_lucky(int l,int r){
for (int i=l;i<=r;++i) if (s[i]!='4'&&s[i]!='7') return 0;
return 1;
}

int find(int k,string a){
int t=s.find(a,k);
if (t==-1) return 0;
return find(t+1,a)+1;
}

int main(){
cin>>s;
int ans=-1;
string res;
for (int i=0;i<=s.size();++i){
  for (int j=i;j<=s.size();++j){
    if (is_lucky(i,j)&&s.substr(i,j-i+1)!=""){
      int tmp=find(0,s.substr(i,j-i+1));
	  if (tmp>ans){
	    res=s.substr(i,j-i+1);
	    ans=tmp;
		}
	  else if (tmp==ans&&s.substr(i,j-i+1)<res){
	  	res=s.substr(i,j-i+1);
	    }
	  }
    }
  }
if (!~ans) puts("-1");
else cout<<res;
}

#include<bits/stdc++.h>
using namespace std;

int main() {
    string n; long long int p = 0;
    int c1=0,c2=0;
    cin>>n;
    for(long long int i=0; i<n.size(); i++){
    	if(n[i]=='4')
    	{
    		c1++;

		}
		if(n[i]=='7')
		{
			c2++;
		}
        p += n[i] - '0';
    }
    char c;

    if(c1==0&&c2==0)
    {
    	cout<<-1;
	}

	else if(c1==0&&c2!=0)
		{
			cout<<'7';
		}
		else if(c2==0&&c1!=0)
		{
			cout<<'4';
		}
		else{
			if(c1>=c2)
			{
				cout<<'4';
			}
			else {
				cout<<'7';
			}

		}

    return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
        char ss[60];
        int a = 0, b = 0, i, len;
        cin >> ss;
        len = strlen(ss);
        for (i = 0; i < len; i++){
                if(ss[i] == '4')
                      a++;
                else if (ss[i] == '7')
                       b++;
        }
        //cout << a << "ddd" << b <<endl;
        if (a == 0 && b ==0)
        cout<< "-1" <<endl;
        else if (a > b)
        cout << "4" <<endl;
        else if (a< b)
        cout << "7" << endl;
        else if (a == b)
        cout << "4" <<endl;
        return 0;
}

#include<iostream>
#include<string>
using namespace std;
string s;
long long n, m, k, i, j;
main(){
       cin>>s;
       for(i=0;i<s.size();i++)if(s[i]-'0'==4)n++;else if(s[i]-'0'==7)m++;
       if(m!=n){
                if(m>n){cout<<7;return 0;}
                else {cout<<4;return 0;}
                }
       if(m==0 && n==0){cout<<-1;return 0;}
       if(m==n)for(i=0;i<s.size();i++)if(s[i]=='4'){cout<<4;return 0;}
       }

#include <bits/stdc++.h>
using namespace std;

int main(){
  string s;
  cin >> s;

  // unordered_map<string, int> cnt;
  // string result = "";
  // int max_occur = 0;
  // string current = "";
  // for(int i = 0; i < s.size(); i++){
  //   if(s[i] == '4' || s[i] == '7'){
  //     current += s[i];

  //     for(int j = 0; j < current.size(); j++){
  //       for(int k = 1; k <= current.size()-j; k++){
  //         string sub = current.substr(j,k);
  //         cnt[sub]++;
  //         if(cnt[sub] > max_occur){
  //           result = sub;
  //           max_occur = cnt[sub];
  //         } else if(cnt[sub] == max_occur && sub < result){
  //           result = sub;
  //         }
  //       }
  //     }
  //   } else{
  //     current = "";
  //   }
  // }

  // if(result.empty()){
  //   cout << -1 << endl;
  // } else{
  //   cout << result << endl;
  // }

  int cnt4 = 0, cnt7 = 0;

  for(const char c: s){
    if(c == '4') cnt4++;
    else if(c == '7') cnt7++;
  }

  if(cnt4 == 0 && cnt7 == 0)
    cout << -1 << endl;
  else if(cnt4 >= cnt7)
    cout << 4 << endl;
  else
    cout << 7 << endl;

  return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,count4=0,count7=0,temp;
    string s;
    cin>>s;
    for(i=0;i<s.length();++i)
    {
        temp = s[i] - '0';
        if(temp == 7)
        ++count7;
        else if(temp == 4)
        ++count4;
    }
    if(count7==0 and count4!=0)
    {
        cout<<"4";
        return 0;
    }
    if(count4==0 and count7!=0)
    {
        cout<<"7";
        return 0;
    }
    if(count4<count7)
    {
        cout<<"7";
        return 0;
    }
    if(count7<count4)
    {
        cout<<"4";
        return 0;
    }
    if(count4 ==0 and count7==0)
    {
        cout<<"-1";
        return 0;
    }
    if(count4 == count7)
        {
            cout<<"4";
            return 0;
        }
    return 0;
}

#include<stdio.h>
int main()
{
	char a[100];
	scanf("%s",a);
	int count4=0,count7=0;
	for(int i=0;a[i]!='\0';i++)
	{
		if(a[i]=='4') count4++;
		if(a[i]=='7') count7++;
	}
	if(count4==count7)
	{
		if(count4==0) printf("-1\n");
		else printf("4\n");
	}
	else if(count4>count7) printf("4\n");
	else printf("7\n");
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,cnt=0,check=0;
    string str;
    cin>>str;
    for(i=0;i<str.size();i++)
    {
        if(str[i]=='4')
        {
            check=1;
            cnt++;
        }else if(str[i]=='7')
        {
            cnt--;
            check=1;
        }

    }
    if(check==1){
        if(cnt>=0)
            cout<<"4"<<endl;
        else
            cout<<"7"<<endl;
    }
    else
            cout<<"-1"<<endl;
}

#include <assert.h>
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <algorithm>
#include <numeric>
#include <functional>
#include <bitset>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <iostream>
using namespace std;

bool lucky(string s) {
	for (int i=0;i<s.length();++i)
		if (s[i]!='4' && s[i]!='7') return false;
	return true;
}

bool cmp(string s1,string s2) {
	if (s1.length()!=s2.length())
		return s1<s2;
	for (int i=0;i<s1.length();++i)
		if (s1[i]!=s2[i]) return s1<s2;
	return s1>s2;
}

int main() {
	string s; cin>>s;
	map<string,int> m;
	int n=s.length();
	for (int size=1;size<=n;++size)
		for (int i=0;i+size<=n;++i) {
			string now=s.substr(i,size);
			if (lucky(now)) m[now]++;
		}
	int big=-1;
	for (map<string,int>::iterator it=m.begin();it!=m.end();it++)
		big=max(big,it->second);
	vector<string> res;
	for (map<string,int>::iterator it=m.begin();it!=m.end();it++)
		if (it->second==big) res.push_back(it->first);
	if (res.empty()) {
		cout<<-1<<endl;
		return 0;
	}
	sort(res.begin(),res.end(),cmp);
	cout<<res[0]<<endl;
	return 0;
}

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#define lld long long int
#define DBG1(vari1) cerr<<#vari1<<" = "<<(vari1)<<endl;
#define DBG2(vari1,vari2) cerr<<#vari1<<" = "<<(vari1)<<" "<<#vari2<<" = "<<(vari2)<<endl;
#define DBG3(vari1,vari2,vari3) cerr<<#vari1<<" = "<<(vari1)<<" "<<#vari2<<" = "<<(vari2)<<" "<<#vari3<<" = "<<(vari3)<<endl;
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	// freopen("input.txt", "r", stdin);
	string s;
	cin >> s;
	map <char,int> m;
	for(int i=0;i<s.size();i++)
	{
		m[s[i]]++;
	}
	if(m['4']==0&&m['7']==0)
		cout << "-1";
	else if(m['4']>m['7'])
		cout << "4";
	else if(m['4']<m['7'])
		cout << "7";
	else if(m['4']==m['7'])
		cout << "4";
}

//Yogesh Jiwanlal Deshmukh
//NIT Hamirpur
#include <bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define f(i,n) for(int i=0;i<(n);i++)
#define fr(i,a,b) for(int i=(a);i<=(b);i++)
#define fd(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define ll long long
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
#define fast_io() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
/////////////////////////////////////////////////////////////////////
int main()
{
    fast_io()
    char s[105];
    cin >> s;
    ll int n = strlen(s);
    ll int a = 0, b = 0;
    f(i, n){
        if(s[i] == '4') a++;
        if(s[i] == '7') b++;
    }
    if(a==0 && b ==0)
    {
        cout << "-1" << endl;
    }
    else if(a >= b){
        cout << "4" << endl;
    }
    else cout << "7" << endl;
    return 0;
}

#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <map>

#define ll long long
#define all(x) (x.begin(),x.end())
#define pii pair<int,int>
#define vvii vector<vector<pair<int,int> > >

using namespace std;

bool lucky(string a){
for(int i=0; i<a.size(); i++) if(a[i]!='4' && a[i]!='7') return 0;
return 1;
}
int main() {
  string s;
  while(cin>>s){
        map<string,int>cnt;
        map<string,int>::iterator ind;
    for(int i=0; i<s.size(); i++){
        for(int j=1; j<=s.size()-i; j++){
            cnt[s.substr(i,j)]++;
        }
    }
    int res=-1;
    string r(55,'7');
    for(ind=cnt.begin(); ind!=cnt.end(); ind++){
        if(lucky(ind->first) && ind->second>res) r=ind->first, res=ind->second;
        else if(lucky(ind->first) && ind->second==res) r=min(r,ind->first);
    }
    res==-1?cout<<-1<<endl:cout<<r<<endl;
  }
return 0;
}

#include <iostream>
#include <string>
using namespace std;
int main() {
    string s, subs;
    cin >> s;
    int i, n4(0), n7(0);
    for(i = 0; i < s.size(); i++) {
        if(s[i] == '4') {
            n4++;
        }
        if(s[i] == '7') {
            n7++;
        }
    }
    if(n4 == 0 && n7 == 0) {
        cout << -1 << endl;
    } else if(n4 >= n7) {
        cout << 4 << endl;
    } else {
        cout << 7 << endl;
    }
    return 0;
}

#include <iostream>
#include <string>
#include <vector>
#include <hash_map>
#include <hash_set>
#include <algorithm>
#include <queue>
#include <sstream>
using namespace std;
typedef long long LL;
#define EPS 0.0000000001

int main()
{
  //  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
	string str;
	cin >> str;
	hash_map<string,int> elem;
	int max = -1;
	string strmax = "";
	for (int i = 0; i < str.length(); i++)
	{
		if (str[i] == '4' || str[i] == '7')
		{
			string tmpstr = "";
			for (int j = 0; j < (str.length()-i); j++)
			{
				if (str[i+j] != '4' && str[i+j] != '7') break;
				tmpstr += str[i+j];
				elem[tmpstr]++;
				if (elem[tmpstr] > max || (elem[tmpstr] == max && tmpstr < strmax))
				{
					max = elem[tmpstr];
					strmax = tmpstr;
				}
			}
		}
	}
	if (max == -1) { cout << -1; return 0;}
	cout << strmax;

    return 0;
}

#include <string>
#include <iostream>
#include <sstream>
#include <cmath>

using namespace std;

inline int countSubstring(string str, string sub)
{
    if (sub.length() == 0) return 0;
    int count = 0;
    for (size_t offset = str.find(sub); offset != std::string::npos; offset = str.find(sub, offset + sub.length())) {
        ++count;
    }

    return count;
}

int getLucky(int indx, int* length) {
    int digitsNum = floor(log(indx) / log(2)), counter = 0 , lucky = 0;
    int groupedCoeffecients = 2*(pow(2 , digitsNum) - 1) - indx;
    while(groupedCoeffecients < 0) {
        digitsNum++;
        groupedCoeffecients = 2*(pow(2 , digitsNum) - 1) - indx;
    }
    int* coef = new int[digitsNum];
    for(int i = 0 ; i < digitsNum ; i++)
        coef[i] = 0;

    do {
        coef[counter] = groupedCoeffecients % 2;
        groupedCoeffecients /= 2;
        counter++;
    }
    while(groupedCoeffecients > 0);

    for(int i = 0 ; i < digitsNum ; i++) {
        lucky += coef[i]*4*pow(10 , i) + abs(1 - coef[i])*7*pow(10 , i);
    }

    *length = digitsNum;
    return lucky;
}

int main() {

    string input, output = "-1";
    int len, startIndx, maxOccurs = 0, itr = 1;
    cin >> input;
    len = input.length();

    for(startIndx = 0 ; startIndx < len ; startIndx++) {
        if(input[startIndx] != '0')
            break;
    }
    input.erase(0 , startIndx);
    len = input.length();

    if(input.find("4") == -1 && input.find("7") == -1) {
        cout << output << endl;
        return 0;
    }

    while(true) {
        int luckyLen, occurs, lucky = getLucky(itr, &luckyLen);
        string luckyStr;
        stringstream ss;
        if((maxOccurs + 1)*luckyLen > len)
            break;
        ss << lucky;
        luckyStr = ss.str();
        occurs = countSubstring(input, luckyStr);
        if(occurs > maxOccurs) {
            maxOccurs = occurs;
            output = luckyStr;
        }
        itr++;
    }

    cout << output << endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define w(x)            int x; cin>>x; while(x--)
#define fast            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll              long long

int main() {
    fast
    string s;
    cin >> s;
    unordered_map<string, int> map;
    int r = 0, l = 0;
    while(r < (int) s.length()) {
        while(r < (int) s.length() && (s[r] != '4' && s[r] != '7')) r++;
        if(r >= (int) s.length()) break;
        string num = "";
        num.push_back(s[r]);
        map[num]++;
        l = r + 1;
        while(l < (int) s.length() && (s[l] == '4' || s[l] == '7')) {
            num.push_back(s[l]);
            map[num]++;
            l++;
        }
        r++;
    }
    if(map.size() == 0) {
        cout << "-1" << endl;
        return 0;
    }
    int mx = INT_MIN;
    for(auto it = map.begin(); it != map.end(); it++) mx = max(mx, it->second);
    set<string> st;
    for(auto it = map.begin(); it != map.end(); it++) {
        if(it->second == mx) {
            st.insert(it->first);
        }
    }
    auto it = st.begin();
    cout << *it << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
# define PI           3.14159265358979323846
const double EPS = 1e-10;
///*****************************************
class
XBallGame
{
public :

};

char s[55];
int main()
{

///freopen("input.txt","r",stdin);
///freopen("output.txt","w",stdout);
cin >> s ;

int sum4 = 0 , sum7 = 0 ;
for(int i=0 ;i<strlen(s) ; i++)
{
    if(s[i]=='4') sum4++;
    else if(s[i]=='7') sum7++;
}
if(sum7==0 && sum4==0) cout << -1 << endl;
else
{

if(sum7 > sum4) cout << 7 << endl;
else cout << 4 << endl ;
}
///-///////////////////////////
return 0;
}

#include<iostream>
#include<string.h>
using namespace std;
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
	char s[100];
	int k4=0,k7=0,i;
	cin>>s;
	for(i=0;i<strlen(s);i++)
	{
		if(s[i]=='4')k4++;
		if(s[i]=='7')k7++;
	}
	if(k4==0 && k7==0)
	{
		cout<<-1;
		return(0);
	}
	if(k4>=k7)cout<<'4';
	else cout<<'7';
}

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
int main()
{
	string s;
	cin >> s;
	int x4 = count(begin(s), end(s), '4');
	int x7 = count(begin(s), end(s), '7');
	if (x4 > x7)
		cout << 4;
	else if (x4 < x7)
		cout << 7;
	else if (x4 == x7 && x4 != 0 && x7 != 0)
		cout << 4;
	if (x4 == 0 && x7 == 0)
		cout << -1;
	return 0;
}
/* Fri Nov 01 2019 19:59:19 GMT+0300 (MSK) */

#include <bits/stdc++.h>
using namespace std;

#define LL long long
#define MAX 100000000

int main()
{
    string str;
    cin >> str;

    int f = 0, s = 0;
    for(int i=0; i<str.size(); i++){
        if(str[i] == '4')
            f++;
        else if(str[i] == '7')
            s++;
    }

    if( f == s && f && s)
        cout << "4\n";
    else if(f > s)
        cout << "4\n";
    else if(f < s )
        cout << "7\n";
    else
        cout << "-1\n";

    return 0;
}

#include <iostream>
#include <string.h>
#include <string>
using namespace std;
int main ()
{
int kol4,kol7,j,i;
string a;
cin>>a;
j=a.length();
kol4=0;kol7=0;
for (i=0;i<j;i++)
{
	if (a[i]=='4') {kol4++;}
	if (a[i]=='7') {kol7++;}
}
if (kol4==0 && kol7==0) {cout<<-1;return 0;}
if (kol4>=kol7) {cout<<4;return 0;} else  {cout<<7;return 0;}
}

#include <bits/stdc++.h>
#define rep(x,n) for(int x=0;x<int(n);++x)
#define print(x) cout<<x<<endl
#define dbg(x) cerr<<#x<<" = "<<x<<endl
#define pv(x,y) {for(typeof(y) z=(x);z!=(y);z++)cerr<<*z<<" ";cerr<<endl;}
#define _ <<" , "<<
#define mp make_pair
#define x first
#define y second
using namespace std;
typedef pair<int,int> pt;

int main() {
  if(true) cin.sync_with_stdio(false);
  string s;
  cin>>s;
  int fo=0,se=0;
  rep(i,s.size()) {
    if(s[i]=='4') fo++;
    if(s[i]=='7') se++;
  }
  if(fo<=0 and se<=0) print(-1);
  else if(fo>=se) print(4);
  else print(7);
  return 0;
}

#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    int e=0,o=0;
    cin>>s;
    for(int i=0; i<s.size(); i++)
    {
    	if(s[i]=='4')
    	e++;
    	else if(s[i]=='7')
    	o++;
	}
	if(e!=0 || o!=0)
	{
		if(e>=o)
		{
			cout<<"4\n";
		}
		else cout<<"7\n";
	}
	else cout<<"-1\n";
	return 0;
}

#include<algorithm>
#include<iostream>
#include<string>
#include<set>
#include<utility>
using namespace std;

int main()
{
  string s;
  cin >> s;

  if(s.find_first_of("47") == string::npos)
  {
    cout << -1 << "\n";
  }else if(count(s.begin(), s.end(), '4') >= count(s.begin(), s.end(), '7'))
  {
    cout << 4 << "\n";
  }else
  {
    cout << 7 << "\n";
  }
}

/* Sun Oct 18 2020 19:13:59 GMT+0300 (Москва, стандартное время) */

#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	int c=0,w=0;
	string x;
	cin>>x;
	for(int i=0;i<x.length();i++){
	if(x[i]=='7')
	 	c++;
    if(x[i]=='4')
		w++;
	}
if(c>w)
	cout<<'7'<<endl;
else{
	if(c==w&&c!=0&&w!=0){
		int y=x.find('7');
		int z=x.find('4');
		//if(y>z)
		cout<<'4'<<endl;
		//else
		//cout<<'7'<<endl;
	}
	else{
		if(w>c)
	 	cout<<'4'<<endl;
		else
			cout<<-1;

	}

}
}

#include <algorithm>
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#define ll long long
using namespace std;

int main()
{
	string s;
	int a = 0, b = 0;
	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == '4')
			a++;
		else if (s[i] == '7')
			b++;
	}
	if (b > a)
		cout << "7";
	else if (a == 0)
		cout << "-1";
	else
		cout << "4";
}

/* Fri Nov 01 2019 20:04:49 GMT+0300 (MSK) */

#include <iostream>
#include <string>

using namespace std;

int main()
{
    string str;
    cin >> str;

    int a = 0;
    int b = 0;
    for(auto i : str)
    {
        if (i == '4')
            a++;
        if (i == '7')
            b++;
    }
    int res = 0;
    if (a >= b)
        cout << ((a == 0) ? -1 : 4) << endl;
    else
        cout << ((b == 0) ? -1 : 7) << endl;
    return 0;
}

//
//  CPlibrary
//
//  Created by Tanmay Singh on 3/03/2020.
// INDIAN INSTITUTE OF TECHNOLOGY (BHU) , VARANASI
//  Copyright © 2020 Tanmay Singh. All rights reserved.
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#include <cstdio>
#include <iterator>
#include <string>
#include <stack>
#include <deque>
#include <unordered_set>
#include <unordered_map>

#define FAST(); ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MAX 1e9+7
#define loopchalao(i , N) for( int i = 0 ; i < N ; i++ )
typedef long long  int  bigint ;

using namespace std ;

int main(){
    string str ; cin >> str ;
    map<int , int> m ;
    for( int i = 0 ; i < str.length() ; i++ ){
        if( str[i] == '4' || str[i] == '7' ){
            m[str[i] - 48 ] ++ ;
        }
    }
    if( m.empty() ){
        cout << "-1" << endl ;
    }
    else{
        if( m[4] >= m[7] ){
            cout << "4" << endl ;
        }
        else{
            cout << "7" << endl ;
        }
    }
    return 0 ;
}

#include<iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <queue>
#include<set>
#include<stack>
#include<cstdio>
#define PI 3.14159265
using namespace std;

int main(){
    std::ios_base::sync_with_stdio(false);
    string s;
    cin >> s;
    int mycount[2] = { 0, 0 };
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == '4') mycount[0]++;
        if (s[i] == '7') mycount[1]++;
    }
    if (mycount[0] == mycount[1] && mycount[0] == 0)
        cout << -1 << endl;
    else if (mycount[0] >= mycount[1]) cout << 4 << endl;
    else cout << 7 << endl;
    //system("PAUSE");
    return 0;
}

#include <string>
#include <vector>
#include <iostream>
using namespace std;

int main()
{
	string s,s1="A",s2;
	int mx=0,m;
	cin >> s;
	for (int i=1;i<=s.size();i++)
		for (int j=0;j<s.size()-i+1;j++)
		{
			s2="";
			for (int h=j;h<j+i;h++) s2+=s[h];
			int c=0;
			for (int h=0;h<s2.size();h++)
				if (s2[h]!='4'&&s2[h]!='7') c=1;
			if (!c)
			{
				m=0;
				for (int h=0;h<s.size()-s2.size()+1;h++)
				{
					int d=0;
					for (int k=0;k<s2.size();k++)
						if (s2[k]!=s[h+k])
						{
							d=1;
							break;
						}
					if (!d) m++;
				}
				if (m>mx||m==mx&&s2<s1)
				{
					s1=s2;
					mx=m;
				}
			}
		}
	if (s1=="A") cout << "-1"<< endl;
	else cout << s1 << endl;
	return 0;
}

#define M_PI           3.14159265358979323846  /* pi */
#include <cstdio>
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <math.h>
#define ri(i) int i;scanf("%d",&i);
#define rii(i,j) int i,j;scanf("%d%d",&i,&j);
#define rc(i) char i;cin>>i;
#define rll(i) long long i;cin>>i;
#define ff(i,s,n) for(int i=(s);i<(n);i++)
#define fr(i,s,n) for(int i=(n-1);i>=(s);i--)
#define FF(i,s,n) for(int i=(s);i<=(n);i++)
#define Fr(i,s,n) for(int i=(n);i>=(s);i--)
#define mp(a,b) make_pair(a,b)

template<typename T, typename U> inline void swap(T &a, U &b) {
    a = a^b;
    b = a^b;
    a = a^b;
}

inline void swap(int &a, int &b) {
    a = a^b;
    b = a^b;
    a = a^b;
}

inline void smax(int &a, int b) {
    if (b > a)a = b;
}

inline void smin(int &a, int b) {
    if (b < a)a = b;
}

inline int gcd(int a, int b) {
    if (a < b)swap(a, b);
    while (b > 0) {
        a -= a / b*b;
        swap(a, b);
    }
    return a;
}

using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pair<string, string> > vpss;
typedef vector<pii > vpii;
typedef vector<vpii > vvpii;
typedef unordered_map<int, int> imap;
typedef unordered_map<long long, long long> lmap;

inline bool f(char c){
    if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
        return 1;
    return 0;
}

string s;
int main() {
    cin>>s;
    int fours=0;
    int sevens=0;
    ff(i,0,s.length()){
        if(s[i]=='7')sevens++;
        else if(s[i]=='4')fours++;
    }
    if(sevens>fours)cout<<"7";
    else if(fours>0)cout<<"4";
    else cout<<-1;
}

#include <iostream>
#include <cstdio>
#include <string>
using namespace std;

int t,m;
string a;

int main(){
    cin>>a;
    for(int i=0;i<a.length();i++)
    {
        if(a[i]=='4')t++;
        if(a[i]=='7')m++;
    }
    if ((m==0)&&(t==0)) cout<<"-1";
    else{
    if(m>t)cout<<"7";
    if (t>=m)cout<<"4";
    }

  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define lli long long
#define endl '\n'
#define mod 1000000007
#define vi(v) std::vector<int> v;
#define meme(arr, a) memset(arr, a, sizeof(arr))
#define set(x) set<int> x;
#define spc " "
#define no "NO"
#define yes "YES"
#define ff "First"
#define ss "Second"
#define idiot "Friendship"
#define rep(i, a, n) for (int i = a; i < n; ++i)
#define nrep(i, a, n) for (int i = n; i >= a; --i)
#define pb(x) push_back(x)
int sub(string s, string q)
{
    long long j = 0;
    int a = s.length();
    int b = q.length();
    for (int i = 0; i < a && j < b; ++i)
    {
        /* code */ if (q[j] == s[i])
            j++;
    }
    if (j == b)
        return 1;
    else
        return 0;
}

char mmv(char c, int a)
{
    string arr[3] = {"qwertyuiop", "asdfghjkl;", "zxcvbnm,./"};
    for (int i = 0; i < 3; ++i)
    {
        /* code */ for (int j = 0; j < 10; ++j)
        {
            /* code */ if (c == arr[i][j])
            {
                if (a)
                    return arr[i][j - 1];
                else
                    return arr[i][j + 1];
            }
        }
    }
}

unsigned Ram()
{
    int n, m, count = 0, c = 0, d = 0;
    string s;
    cin >> s;
    n = s.length();
    for (int i = n - 1; i >= 0; i--)
        if (s[i] == '4')
            c++;
        else if (s[i] == '7')
            d++;
    if (d > c)
        cout << 7;
    else if (c >= d && c != 0)
        cout << 4;
    else
        cout << -1;
}
/*ifstream in("input.txt");
ofstream ou("output.txt");*/

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    lli t;
    t = 1;
    // cin >> t;

    while (t--)
    {
        Ram();

        cout << endl;
    }
    return 0;
}

#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
int sn,fn;

int main(void)
{
   int i,j,m,n,t;
   char s[60];
   scanf("%s",s);
   for(i=0;i<strlen(s);i++)
   {
      if(s[i]=='7') sn++;
      if(s[i]=='4') fn++;
   }

   if(sn==0&&fn==0) printf("-1\n");
   else (sn>fn)?printf("7\n"):printf("4\n");

   return 0;
}

#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int c4 = 0, c7 = 0;
    for (int i = 0; i < s.size(); ++i)
    {
        if (s[i] == '4')
            c4++;
        if (s[i] == '7')
            c7++;
    }
    if (c4 == 0 && c7 == 0)
        cout << -1;
    else if (c4 == c7)
        cout << 4;
    else if (c7 > c4)
        cout << 7;
    else
        cout << 4;
}
/* Fri Nov 01 2019 21:02:27 GMT+0300 (MSK) */

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define ft first
#define sd second
#define get(t, x) get<x>(t)
#define pb push_back
#define len length
#define dbgn(x) cerr << #x << ": " << x << '\n'
#define dbg(x) cerr << #x << ": " << x << ' '
#define MAX 1000010

using namespace std;
using namespace __gnu_pbds;

using lli = long long int;
using pll = pair<lli, lli>;
using pii = pair<int, int>;
using mii = map<int, int>;
using ti3 = tuple<int, int, int>;
using pqpi_min = priority_queue<pii, vector<pii>, greater<pii>>;
using ost = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;

//int+string
//cin.ignore();

constexpr int M = 1e9 + 7;

void solve()
{
    string s;
    int _4=0,_7=0;
    cin>>s;
    _4=count(s.begin(),s.end(),'4');
    _7=count(s.begin(),s.end(),'7');
    if (_4+_7==0) cout<<-1;
    else if (_4>=_7) cout<<4;
    else cout<<7;

}

int main(int argc, char const *argv[])
{
    ios::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
    freopen("inp.txt", "r", stdin);
#endif
    solve();
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int arr[2];
int main()
{
      int temp ;
     string s; cin >> s;
     int x=s.length();
     for(int i=0 ;i<x;++i)
     {
           if(s[i] == '4')
           ++arr[0];
           if(s[i] == '7')
           ++arr[1];
     }
     if((arr[0] == 0 && arr[1] == 0))
     {printf("-1"); return 0;}

     temp=(arr[0] < arr[1])?7:4;
       printf("%d",temp);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

 int main() {
  int cnt=0,cpt=0;
  string s;
  cin>>s;
  for(int i=0;i<s.length();i++){
    if(s[i]=='7'){
      cnt++;
    }
    else if(s[i]=='4')
      cpt++;
  }

  //cout<<cpt<<" "<<cnt<<"\n";

  if(cpt>=cnt){
    if(cnt==cpt && cnt!=0 && cpt!=0)
      cout<<"4\n";
    else if(cpt>cnt)
      cout<<"4\n";
    else
      cout<<"-1\n";
  }
  else if(cnt>cpt)
    cout<<"7\n";

  return 0;
}

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <random>
using namespace std;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    string s;
    cin >> s;

    int k4 = count(s.begin(), s.end(), '4');
    int k7 = count(s.begin(), s.end(), '7');

    if (!k4 && !k7) {
        cout << -1;
    } else if (k4 >= k7) {
        cout << 4;
    } else {
        cout << 7;
    }
}

// (.Y.)

#define _USE_MATH_DEFINES

#include <cmath>
#include <cstdio>

#include <algorithm>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define ll long long

#define mp make_pair
#define pb push_back

#define DEBUG(x) cout << #x << ": " << (x) << endl;

int main() {
#ifndef ONLINE_JUDGE
    freopen( "input.txt", "rt", stdin );
    //freopen("output.txt", "wt", stdout);
#endif

    string s;
    cin >> s;

    int c4 = 0;
    int c7 = 0;

    for (int i = 0; i < s.length(); i++) {
        if ( s[i] == '4' ) c4++;
        if ( s[i] == '7' ) c7++;
    }

    if ( c4 == 0 && c7 == 0 ) {
        cout << -1;
        goto exit;
    }

    cout << ( c4 >= c7 ? 4 : 7 );

exit:
    return ( 0 );
}

#include <iostream>
#include <map>
#include <stdio.h>

using namespace std;

string get;
map<string, int> mp;

int main(void) {
    //freopen("i.in", "r", stdin);
    getline(cin, get);

    for(int i = 0; i < get.size(); i++) {
        int j = i;
        while(j <= get.size() && get[j] == '4' || get[j] == '7') {
            mp[get.substr(i, j - i + 1)] += 1;
            j += 1;
        }
    }

    int maximal = -1; string ans = "jhashduahdsuashduasdfhajsdhfljkshadflkjhdflkjasd";
    for(map<string, int>::iterator it = mp.begin(); it != mp.end(); it++) {
        if((*it).second >= maximal && (*it).first != "") {
            maximal = (*it).second;
            ans = (*it).first;
        }
    }
    for(map<string, int>::iterator it = mp.begin(); it != mp.end(); it++) {
        if((*it).second == maximal && (*it).first < ans) {
            ans = (*it).first;
        }
    }
    if(ans == "jhashduahdsuashduasdfhajsdhfljkshadflkjhdflkjasd") {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
    return 0;
}

#include<iostream>
#include<string>
using namespace std;
string s;
long long n, m, k, i, j;
main(){
       cin>>s;
       for(i=0;i<s.size();i++)if(s[i]-'0'==4)n++;else if(s[i]-'0'==7)m++;
       if(m!=n){
                if(m>n){cout<<7;return 0;}
                else {cout<<4;return 0;}
                }
       if(m==0 && n==0){cout<<-1;return 0;}
       if(m==n)for(i=0;i<s.size();i++)if(s[i]=='4'){cout<<4;return 0;}if(s[i]=='7'){cout<<7;return 0;}
       }

#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <math.h>
#include <map>
#include <queue>

using namespace std;

long long n,x,i,k4=0,k7=0;
string s;
long ans;

int main(){
    cin>>s;
    for(i=0;i<s.length();i++)
      if(s[i]=='4'){k4++;}
      else if(s[i]==7){k7++;}
      if(k4==0&&k7==0)cout<<-1;
      if(k4>k7||k4==k7)cout<<4;else cout<<7;
 return 0;
}

#include<iostream>
#include<cmath>
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;
bool lucky(string s){
    for(int i=0;i<s.length();i++)
        if(s[i]=='4' && s[i+1]=='7' || s[i]=='7' && s[i+1]=='4')
            return true;
return false;
}
int main(){
string s;int four=0,seven=0;
cin>>s;
if(!lucky(s)){cout<<-1<<endl;return 0;}
for(int i=0;i<s.length();i++){
    if(s[i]=='7')
        seven++;
    if(s[i]=='4')
        four++;
}
if(seven<four)
    cout<<7<<endl;
else
    cout<<4<<endl;

  return 0;
}

#include <iostream>

using namespace std;

int main()
{
   string num;
   cin>>num;
   int n4(0) , n7(0);
   for(int i=0 ; i<num.length() ; i++){
      if(num[i]=='4') n4++;
      if(num[i]=='7') n7++;
   }

   if(n4 > n7 ) cout<<4<<endl;
   else if(n7>n4) cout<<7<<endl;
   else cout<<-1<<endl;
    return 0;
}

#include <iostream>
#include <string>
using namespace std;

int main()
{
string s;
int n,i,u=0,k=0;
cin>>s;
for(i=0;i<s.length();i++){if(s[i]=='4'){u++;}
if(s[i]=='7'){k++;}}
if(k>u){cout<<7;return 0;}
if(u>=k){cout<<4;return 0;}
cout<<-1;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,mx=-1;
    string a;
    string s;
    map<string,int>mp;
    cin>>s;
    //cout<<s<<endl;
    for(i=0; s[i]!='\0'; i++)
    {
        if(s[i]=='4'||s[i]=='7')
        {
            a+=s[i];
            mp[a]++;
            //cout<<a<<endl;
            //printf("mp=%d\n",mp[a]);
            for(j=0;; j++)
            {
                if(s[j]=='7'||s[j]=='4')
                {
                    a+=s[j];
                    mp[a]++;
                }
                else
                {
                    a.clear();
                    break;
                }
            }
        }
    }
    if(mp.empty())
    {
        a="-1";
    }
    else
    {
        auto it=mp.begin();
        a=it->first;
        for(++it; it!=mp.end(); it++)
        {
            if(mx<it->second)
            {
                mx=it->second;
                a=it->first;
            }
        }
    }
    cout<<a<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
main(){
int n,l,l1,l2,i,count1=0,count2=0;
cin>>n;

while(n)
{
    l=n%10;
    n=n/10;
    if(l==4)count1++;
    if(l==7)count2++;

}

if(count1==0 && count2==0)
    cout<<"-1"<<endl;
else if(count1>count2)
    cout<<"4"<<endl;
else cout<<"7"<<endl;
return 0;

}

#include <algorithm>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

bool isL(int x) {
	int dig;
	while(x) {
		dig = x%10;
		x /= 10;
		if(dig == 7 || dig == 4);
		else return false;
	}
	return true;
}

string str;

int main() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin );
	//freopen("ou.txt", "w", stdout);
#endif
	int a = 0, b = 0;
	cin >> str;

	if(isL(atoi(str.c_str())) == false) {
		puts("-1");
		return 0;
	}
	for(int i = 0; i < (int)str.size(); ++i) {
		if(str[i] == '4')	a++;
		if(str[i] == '7') b++;
	}

	if(a >= b)	cout << "4";
	else		cout << "7";

	return 0;
}

#include "bits/stdc++.h"
using namespace std;
//https://codeforces.com/problemset/problem/122/B

int main()
{
    string str; cin >> str;
    map<char, int> myMap;

    for(size_t i = 0; i < str.length(); i++)
    {
        if(str[i] == '7')
            myMap[str[i]]++;

        else if(str[i] == '4')
            myMap[str[i]]++;
    }

    if(myMap['7'] > myMap['4'])
        cout << 7 << endl;

    else if(myMap['7'] <= myMap['4'])
        cout << 4 << endl;

    else
        cout << -1 << endl;

    return 0;
}

#include<iostream>
using namespace std;
int main ()
{
	long long a,b,c,d,e,f,g,h,i,l;
	char x[70];
	cin>>x;
	d=0;
	e=0;
	h=strlen(x);
	for(b=0;b<h;b++)
	{
		 if(x[b]=='4') d++;
			 if(x[b]=='7') e++;
	}
	if (d<e) cout<<7;
	if (d>e) cout<<4;
	if ((d==0)&&(e==0)) cout<<-1;
	return 0;
}

#include <cstdlib>
#include <iostream>
#include <vector>
#define fore(i,a) for(int i = 0;i<a.size();i++)
using namespace std;
int main() {
    string num;
    cin >> num;
    int x[2] = {0};
    fore(i,num) {
        if (num[i] == '4')
            x[0]++;
        else if (num[i] == '7')
            x[1]++;
    }
    if (x[1] >= x[0] && x[1]!=0&&x[0]!=0)
        cout << 4;
    else if (x[1] > x[0])
        cout << 7;
    else
        cout << "-1";
    return 0;
}

//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <set>
#include <cmath>
#include <math.h>
#include <map>
#include <string>
#include <vector>
#define li int
#define lc char
#define ls string
#define r_0 return 0
#define pb push_back
#define ll long long
#define ld long double
using namespace std;
set <ll > se ;
vector <int >   v ,  v1,v2,v3;
const ll N=1e5+7 ;
const ll M=1e6+7 ;
const ll MOD=1e7+7 ;
const ll DIV=1e8+7 ;
const ll K=1e9+7 ;
ll n  , ans,sum, mn=10000000,y,mx,m, z,i , b[N],cnt1 , cur    , d   ,e ,r  , a  , c ;
string s1,s2,s3, s4, s5 , s,g,h;
ll  cnt    ;
char l ;
map <string , string> mp ;
int main()
{
//freopen("standard.in" , "r" , stdin);
//freopen("standard.out" , "w" , stdout);
    cin >> s;
    if (s.size ( )   > 2 ) {
  for (ll i = 0 ; i <s.size ( ) ;  i ++ )  {
        l=  s[ s.size()/2] ;
    }
    cout << l  << endl ; ;
    }
    else {
        cout << -1 << endl ;
    }
}

#include <bits/stdc++.h>
#define pi 3.14159265359
using namespace std;

int main(){
    string s;cin>>s;
    int seven=0,four=0;
    for(int i=0;i<s.length();i++){
        if(s[i]=='4'){
            four++;
        }
        else if(s[i]=='7'){
            seven++;
        }

    }
    if(seven>four){
        cout<<'7';
    }
    else if(seven<four){
        cout<<'4';
    }
    else if (seven ==0 && four ==0){
        cout<<'-1';
    }
    else{
        cout<<'4';
    }

    return 0;

}

#include <bits/stdc++.h>
#include <algorithm>
#include <iterator>
#include<cmath>
using namespace std;
#define ll long long
#define mod 1000000007
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL);
#define tc int tc; cin >> tc; while (tc--)
#define pb push_back
#define mp make_pair
#define r_0 return 0
#define FOR(i, n) for (int i = 1; i <= int(n); i++)
using namespace std;

int main()
{
    fio
    string s;
    cin>>s;
    int cnt4=0,cnt7=0;
    for(int i=0;i<s.length();i++){
      if(s[i]=='4'){
          cnt4++;
      }
      if(s[i]=='7'){
          cnt7++;
      }
   }
   if(cnt4==0&&cnt7==0){
       cout<<"-1"<<endl;
   }
   else{
       if(cnt4>cnt7){
           cout<<"4";
       }
       else
       {
           cout<<"7";
       }
   }
return 0;
}

#include <bits/stdc++.h>

using namespace std;
bool islucky(string s0,int l)
{
    for(int i=0; i<l; i++)
    {
        if(s0[i]!='4'&&s0[i]!='7')
        {
            return 0;
        }
    }
    return 1;
}
int main()
{
    int maxl=-1;
    string s,sub,mins;
    map<string,int>m;
    map<string,int>::iterator t;
    cin>>s;
    cout<<s.size()<<endl;
    for(int i=0; i<s.size(); i++)
    {
        for(int l=1; l<=s.size(); l++)
        {
            sub=s.substr(i,l);
            if(islucky(sub,l))
            {
                m[sub]++;
                sub.erase();
            }
            else
                break;
        }
    }
    mins="a";
    if(m.empty())
        cout<<-1<<endl;
    else
    {
        for(t=m.begin(); t!=m.end(); t++)
        {
            if(t->second>=maxl)
            {
                maxl=t->second;
            }
        }
        for(t=m.begin(); t!=m.end(); t++)
        {
            if(t->second==maxl)
            {
                mins=min(t->first,mins);
            }
        }
        cout<<mins<<endl;
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    char finl=-1,first;
    int sz,i,cnt,mx;
    cnt=0;mx=1;
    cin>>str;
    sz=str.size();
    for(i=0;i<sz;i++)
    {
        //cout<<i<<endl;
        if(str[i]=='4' || str[i]=='7')
        {
            cnt++;
            if(cnt==1)
            {
                first=str[i];
            }
        }
        else
        {
            //cout<<cnt<<endl;
            if(mx<=cnt)
            {
                //cout<<"first";

                mx=cnt;
                cnt=0;
                if(cnt>1)
                finl=(cnt%2!=0)?first:(first=='4')?'7':'4';
                else
                    finl=first;
                //cout<<"final"<<finl<<endl;
            }
        }
    }
    if(mx<=cnt)
            {

                if(cnt>1)
                finl=(cnt%2!=0)?first:(first=='4')?'7':'4';
                else
                    finl=first;
            }
    if(finl==-1)
        cout<<"-1";
    else
    printf("%c",finl);
}

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int four  , seven;
bool Lucky(string a){
    int x = a.length() , y = 0;
    for(int i = 0; i < x ; i++){
        if(a[i] == '4')y++ , four++;
        if(a[i] == '7')y++ , seven++;
    }
    return (x == y);
}
int main ()
{
    string s , sub;
    cin >> s;
    int l = s.length() , i = 0 , x = 0 , y = 0;
    while(s[i] == '0')i++;
    while(i < l){
        for(int j = 1 ; j <= l-i ; j++)
        {
            sub = s.substr(i , j);
            four = seven = 0;
            //cout << sub << " ";
            if(Lucky(sub))
                x += (four>=seven) , y += (seven>four);
        }i++;
        //cout << "\n";
    }
    ///cout << x << " " << y << "\n";
    if(x > y)      cout << "4\n";
    else if(x < y) cout << "7\n";
    else if(x && y)cout << "7\n";
    else           cout << "-1";
	return 0;
}

#include <iostream>
using namespace std;
int cnt[10];

int main()
{
    string str;
    cin >> str;
    for(int i = 0 ;i < str.length(); ++i)
    {
        cnt[str[i]-'0']++;
    }
    int mmax = 0;
    int ind = 4;
    for(int i = 0; i < 9; ++i)
        if(cnt[i] > mmax)
        {
            mmax = cnt[i];
            ind = i;
        }
    if((cnt[4] == 0 && cnt[7] == 0))
        cout <<-1 << endl;
    else if(cnt[4] > cnt[7])
        cout << 4 << endl;
    else if(cnt[7] > cnt[4])
        cout << 7 << endl;
    else
    {
        for(int i = 0; i < str.length(); ++i)
            if(cnt[i] > cnt[4] || cnt[i] > cnt[7])
        {
            cout << -1 <<endl;
            break;
        }
        for(int i = 0; i < str.length(); ++i)
            if(str[i] == '4' || str[i] == '7')
            {
                cout << str[i] << endl;
                break;
            }
    }
    return 0;
}

//#include <set>
//#include <stdio.h>
//#include <cmath>
//using namespace std;
//
//#define rep(i,n) for(int i = 0; i < (n); ++i)
//
//bool lucky(int k)
//{
//    while(k)
//    {
//        if(k%10 != 4 && k%10 != 7)
//            return false;
//        k/= 10;
//    }
//    return true;
//}
//
//bool almostlucky(int k)
//{
//    if(lucky(k))
//        return true;
//
//    for(int i = 1; i * i <= k; ++i)
//    {
//        if(k % i == 0 && lucky(i))
//
//                return true;
//    }
//    return false;
//}
//int main()
//{
////    freopen("input.txt", "r", stdin);
////    freopen("output.txt", "w", stdout);
//    int n;
//    scanf("%d", &n);
//    if(lucky(n) || almostlucky(n))
//        printf("YES");
//    else
//        printf("NO");
//    printf("\n");
//    return 0;
//}

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int comp(const void *p, const void *q)
{
	return (*(int*)q - *(int*)p);
}
int main()
{
	char a[10002];
	int i, b = 0, c = 0;
	gets(a);
	for (i = 0; i < strlen(a); ++i)
	{
		if (a[i] == '4')
			++b;
		if (a[i] == '7')
			++c;
	}
	if (b&&c)
	{
		if (b < c)
			printf("7\n");
		else
			printf("4\n");
	}
	else
		printf("-1\n");
}

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int four  , seven;
bool Lucky(string a){
    int x = a.length() , y = 0;
    for(int i = 0; i < x ; i++){
        if(a[i] == '4')y++ , four++;
        if(a[i] == '7')y++ , seven++;
    }
    return (x == y);
}
int main ()
{
    string s , sub;
    cin >> s;
    int l = s.length() , i = 0 , x = 0 , y = 0;
    while(s[i] == '0')i++;
    while(i < l){
        for(int j = 1 ; j <= l-i ; j++)
        {
            sub = s.substr(i , j);
            four = seven = 0;
            ///cout << sub << " ";
            if(Lucky(sub))
                x += four , y += seven;
        }i++;
        ///cout << "\n";
    }
    if(x > y)      cout << "4\n";
    else if(x < y) cout << "7\n";
    else if(x && y)cout << "4\n";
    else           cout << "-1";
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
   int a=  count(s.begin(),s.end(),'4');
   int b = count(s.begin(),s.end(),'4');
   if(a==0 && b==0){
       cout<<"-1";
   }
   else{
       if(a>=b){
           cout<<"4";
       }
       else{
           cout<<"7";
       }

   }
}

#include <iostream>
#include <string>
using namespace std;
int main()
{
    string str;
    cin >> str;
    int sz = -1;
    bool f = false;
    while(str[sz+1])
    {
        sz++;
        if(str[sz] == '4' || str[sz] == '7')
            f=true;
    }
    if(f)
    {
        if(sz<=1)
            cout << "-1";
        else
            if(sz%2 == 0)
                cout << str[(sz / 2)];
            else
                cout << str[(sz / 2)+1];
    }
    else
        cout << "-1";
    cout << endl;
    return   0;
}

#include <bits/stdc++.h>
/*
*
*
*    Author by Mouhanad
*
*/
using namespace std;
typedef long long ll;
#define F first
#define S second
#define ii pair < int , int >
#define pb(x) push_back(x)
const ll inf = 10000000000000001 ;
ll n , m , k = 0  , q  ;
string s ;
map < string , int > mp ;
bool is_lucky ( string x )
{

    for ( int i = 0 ; i < x.length() ; i++ )
    if ( x[i] != '4' && x[i] != '7' ) return 0 ;
    return 1 ;
}
int main()
{
    cin >> s ;

       n = s.length();

        for ( int i = 1 ; i <= n ; i++ )
        {
            for ( int j = 0 ; j < n - i  ; j++  )
            {
                string str ="";
                for ( int u = j ; u <= j + i - 1 ; u++)
                {
                    str.pb(s[u]);
                }
                mp[str]++ ;
            }
        }
    int cnt = 0 ;

    s = "-1";

    for ( auto x : mp )
    {
        if (is_lucky(x.F))
        {
            if ( cnt < x.S)
            {
                cnt = x.S ;
                s = x.F ;
            }
        }
    }

    cout<<s ;

    return 0 ;
}

#define _CRT_SECURE_NO_WARNINGS
# include <iostream>
# include <cmath>
# include <algorithm>
# include <cstdio>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
#include <stdio.h>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
#include<iomanip>
# include <deque>
# include <functional>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
#include<map>
using namespace std;
vector<long long>m;
vector<long long>m1;
long m3[10000];
map<long long, long long>m2;
char m4[1005][1005];
long long  p = 129999999,  l, r, x, y, counter = 0, counter1=0,c = 0, res = 0;;
int main()
{

	string q;
	long long c1 = 0;
		char c2;

		int mm[26];
		for (int i = 0; i < q.size(); i++)
		{
			mm[q[i] - '0']++;
		}
		if (mm[4] == 0 && mm[7])
			cout << -1 << endl;
		else if (mm[4] >= mm[7])cout << 4 << endl;
		else cout << 7 << endl;
	cin>>x;
	return 0;
}

/*input
047
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define REP(i,j,k)     for(int i = j ; i < k ; ++i)
#define RREP(i,j,k)    for(int i = j ; i >=k ; --i)
#define A    first
#define B    second
#define mp   make_pair
#define pb   emplace_back
#define PII pair<int , int>
#define MEM(i,j)   memset(i , j , sizeof i)
#define ALL(i)     i.begin() , i.end()
#define DBGG(i,j)     cout << i << " " << j << endl
#define DB4(i,j,k,l)  cout << i << " " << j << " " << k << " " << l << endl
#define IOS cin.tie() , cout.sync_with_stdio(0)
#define endl "\n"
///------------------------------------------------------------
#define MAX
#define INF 0x3f3f3f3f

string s;

int32_t main(){
	IOS;
	cin >> s;
	int v1=  0 , v2 = 0;
	REP(i , 0 , s.size()){
		if(s[i] == '4') v1 ++;
		if(s[i] == '7') v2 ++;
	}
	if(v1 == 0 && v2 == 0) cout << -1 << endl;
	else if(v1 <= v2) cout << 4 << endl;
	else cout << 7 << endl;
    return 0;
}

#include<iostream>
#include<string>
using namespace std;
int nums[2], minindex = -1;
main()
{
      string numbers;
      cin>>numbers;
      for(int x = 0; x < numbers.size(); x++)
      {
              if(numbers[x]-48 == 7)
              {
              nums[1]++;
              if(minindex == -1)
              {
                          minindex = x;
                          }
              }
              else
              {
                  nums[0]++;
              if(minindex == -1)
              {
                          minindex = x;
                          }
              }
      }
      if(nums[0] > nums[1])
      {
                 cout<<"4";
                 }
      else if(nums[0] < nums[1])
      {
           cout<<"7";
           }
      else if(nums[0] == nums[1] && nums[0] != 0)
      {
           cout<<numbers[minindex];
           }
      else if(nums[0] == nums[1] && nums[0] == 0)
      {
           cout<<"-1";
           }
      }

#include <algorithm>
#include <iostream>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <queue>
#include <cmath>
#include <list>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
bool IsLucky (string s);
int main (){
int max = 0 ;
string s , test;
map <string , int> MAP ;
map <string , int>::iterator it1 ;
set <string> S ;
set <string>::iterator it;
cin>>s;
for (int i = 1 ; i < s.size() ; i++){
    for (int j = 0 ; j+i <= s.size() ; j++){
        test = s.substr(j,i) ;
        if (IsLucky(test)){
            MAP[test]++ ;
            if (MAP[test] > max)max = MAP[test] ;
            }
        }
    }
for (it1 = MAP.begin() ; it1 != MAP.end() ; *it1++){
    if ((*it1).second == max)S.insert((*it1).first);
    }
if (S.size() == 0){cout<<-1;return 0 ; }
it = S.begin();
cout<<*it;
return 0;
}
bool IsLucky (string s){
     for (int i = 0 ; i < s.size() ; i++){
         if (s[i] == '4')continue;
         if (s[i] == '7')continue;
         return false ;
         }
return true ;
}

//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <set>
#include <cmath>
#include <math.h>
#include <map>
#include <string>
#include <vector>
#define li int
#define lc char
#define ls string
#define r_0 return 0
#define pb push_back
#define ll long long
#define ld long double
using namespace std;
set <ll > se ;
vector <int >   v ,  v1,v2,v3;
const ll N=1e5+7 ;
const ll M=1e6+7 ;
const ll MOD=1e7+7 ;
const ll DIV=1e8+7 ;
const ll K=1e9+7 ;
ll n  , ans,sum, mn=10000000,y,mx,m, z,i , b[N],cnt1 , cur    , d   ,e ,r  , a  , c ;
string s1,s2,s3, s4, s5 , s,g,h;
ll  cnt    ;
char l ;
map <string , string> mp ;
int main()
{
//freopen("standard.in" , "r" , stdin);
//freopen("standard.out" , "w" , stdout);
    cin >> s;
    if (s.size ( )   > 2 ) {
  for (ll i = 0 ; i <s.size ( ) ;  i ++ )  {
      if (s[i]=='4'){cnt ++ ;  }
      if (s[i]=='7'){cnt ++  ; }
        l=  s[ s.size()/2] ;
    }
        if (cnt >=1 and ans >=1  )  {
            cout << l  << endl ; ; }
        else {
            cout << -1 << endl ;
        }
    }
    else {
        cout << -1 << endl ;
    }
}

#include<bits/stdc++.h>
#define ii pair<int,int>
#define fi first
#define se second
using namespace std;

map<string, int> ss;
int main(){
    string s;
    cin>>s;
    for(int i = 0;i<s.length();i++){
        string tem = "";
        int bisa = 0;
        for(int j = i;j<s.length();j++){
            tem+=s[j];
            if(s[j] == '4' || s[j]== '7') bisa = 1;
            if(tem[0] != '0' && bisa) ss[tem]++;
        }
    }
    int maxi = 0;
    for(auto e : ss){
        // cout<<e.fi<<" "<<e.se<<"\n";
        maxi = max(maxi, e.se);
    }

    for(auto e : ss){
        if(e.se == maxi){
            cout<<e.fi<<"\n";return 0;
        }
    }
    cout<<"-1\n";
    return 0;
}

#include <bits/stdc++.h>
#define ll long long
#include<algorithm>
#include<iostream>
using namespace std;

int main()
{
      ios_base::sync_with_stdio(false);
    cin.tie(NULL);
string s;
cin>>s;
int p=0;
bool k =true;
for(int i=0;i<s.length();i++)
{
    if(s.at(i)=='4')
    {
        p++;
       k=false;
       continue;
    }
    else if(s.at(i)=='7')
    {
     p--;
       k=false;
       continue;
    }
    if(i==s.length()-2 && p==0)
    {
        if(s.at(i+1)!='4'&&s.at(i+1)!='7')
              {
        cout<<-1;
        return 0;
    }
    }

}

if(p>=0)
    cout<<4;
else
 cout<<7;
}

#include<iostream>
using namespace std;
int main ()
{
	long long a,b,c,d,e,f,g,h,i,l;
	char x[70];
	cin>>x;
	d=0;
	e=0;
	h=strlen(x);
	for(b=0;b<h;b++)
	{
		 if(x[b]=='4') d++;
			 if(x[b]=='7') e++;
	}
	if (d<e) cout<<7;
	if (d>e) cout<<4;
	if ((d==0)&&(e==0)) cout<<-1;
	return 0;
}

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
 vector <string> a;
 vector <int> b;
int main(){

    int n,k;
    string s,m;
    cin>>s;
    for(int i=0;i<=s.size();++i){
        for(int j=0;j<=s.size()-i;++j)
            a.push_back(s.substr(i,j));

    }
    sort(a.begin(),a.end());
    int f=0;
unique(a.begin(),a.end());
    for(auto i=0;i<a.size();++i){
            if(find(a[i].begin(),a[i].begin()+2,'0')!=a[i].begin()+2){
                ++f;
                }
    }
    for(int i=f+1;i<a.size();++i){
            if((find(a[i].begin(),a[i].end(),'4')!=a[i].end()||find(a[i].begin(),a[i].end(),'7')!=a[i].end())){
        b.push_back(count(a.begin(),a.end(),a[i]));
            }
    else b.push_back(-1);
    }
    int maxx=-1;
    k=0;
    for(int i=0;i<a.size()-f-1;++i){

        if(maxx<b[i])
        {
            maxx=b[i];
            k=i;
        }
    }
    if(maxx==-1)
        cout<<-1;
    else
    cout<<a[k+f+1];
    return 0;
}

/* Sun Oct 18 2020 17:22:43 GMT+0300 (Москва, стандартное время) */

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define dub long double
#define FOR(i, a, b) for (int i=(a); i<(b); ++i)
#define ROF(i, a, b) for (int i=(a); i>(b); --i)
#define CASET int _T; cin >> _T; FOR(caset, 1, _T+1)
#define pii pair<int,int>
#define t3i tuple<int,int,int>
#define mii map<int,int>
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define vvi vector<vi>
#define vvb vector<vb>
#define vpii vector<pii>
#define vt3i vector<t3i>
#define vvpii vector<vpii>
#define sq(x) (x)*(x)
#define inv(x) powa(x, MOD-2)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SIZE(x) (signed)(x).size()
#define SUM(x) accumulate(ALL(x), 0LL)

long long INF = 1LL<<60;
long long MOD = 1e9 + 7;

namespace output {
    void pr(short x) { cout << x; }
    void pr(signed x) { cout << x; }
    void pr(long x) { cout << x; }
    void pr(long long x) { cout << x; }
    void pr(unsigned short x) { cout << x; }
    void pr(unsigned x) { cout << x; }
    void pr(unsigned long x) { cout << x; }
    void pr(unsigned long long x) { cout << x; }
    void pr(float x) { cout << x; }
    void pr(double x) { cout << x; }
    void pr(long double x) { cout << x; }
    void pr(char x) { cout << x; }
    void pr(const char* x) { cout << x; }
    void pr(const string& x) { cout << x; }
    void pr(bool x) { cout << x; }
    template<size_t sz> void pr(const bitset<sz>& x) { cout << x; }
    template<class T> void pr(const complex<T>& x) { cout << x; }

    template<class T1, class T2> void pr(const pair<T1,T2>& x);
    template<class T1, class T2, class T3> void pr(const tuple<T1,T2,T3>& x);
    template<class T> void pr(const T& x);

    template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { pr(t); pr(ts...); }
    template<class T1, class T2> void pr(const pair<T1,T2>& x) { pr("(",x.first,", ",x.second,")"); }
    template<class T1, class T2, class T3> void pr(const tuple<T1,T2,T3>& x) { pr("(",get<0>(x),", ",get<1>(x),", ",get<2>(x),")"); }
    template<class T> void pr(const T& x) {
        pr("["); // const iterator needed for vector<bool>
        bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0;
        pr("]");
    }

    void print() { pr("\n"); } // print w/ spaces
    template<class T, class... Ts> void print(const T& t, const Ts&... ts) { pr(t); if (sizeof...(ts)) pr(" "); print(ts...); }
}
using namespace output;

template<typename T = int> vector<T> create(size_t n){ return vector<T>(n); }
template<typename T, typename... Args> auto create(size_t n, Args... args){ return vector<decltype(create<T>(args...))>(n, create<T>(args...)); }

template <class T1, class T2> istream &operator>>(istream &is, pair<T1,T2> &x) { is >> x.first >> x.second; return is; }
template <class T1, class T2, class T3> istream &operator>>(istream &is, tuple<T1,T2,T3> &x) { is >> get<0>(x) >> get<1>(x) >> get<2>(x); return is; }
template <class T> istream &operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
int powa(int base, int exp) {
    int res = 1;
    while (exp) {
        if (exp&1) res = res*base % MOD;
        base = base*base % MOD;
        exp >>= 1;
    }
    return res;
}
bool mini(int &a, int b) { return b < a ? a = b, 1 : 0; }
bool maxi(int &a, int b) { return b > a ? a = b, 1 : 0; }

signed main() {
    ios::sync_with_stdio(0), cin.tie(0);

    string s;
    cin >> s;

    int n = SIZE(s);

    int c4=0, c7=0;
    FOR(i, 0, n) {
        if (s[i] == '4') c4++;
        if (s[i] == '7') c7++;
    }
    print(c4>c7 ? 4 : 7);
}

#include<bits/stdc++.h>
// printf("%I64d",&x) ;
// scanf("%I64d",&x) ;
using namespace std ;
typedef long long ll ;
main()
{
     string s ;
     cin >> s ;
     int maxx7= 0 , maxx4 = 0;

     bool ok = 0 ;
    for(int i = 0 ; i < s.length(); i++)
    {

        if(s[i]=='7')
        {ok = 1 ;
            maxx7++;

        }else if(s[i]=='4') ok=1 , maxx4++;

    }
    if(ok)
        if(maxx7<maxx4)
        cout << 7 <<endl;
    else
        cout << 4 <<endl ;
    else
        cout << -1 <<endl ;

}

#include<iostream>
#include<string>
using namespace std;
int main(){
  string s; cin>>s;
  char ans;
  bool ok=0;
  for(int i=0;i<s.size();i++)
    if(s[i]=='4') ans=s[i],ok=1;
    else if(s[i]=='7'&&!ok) ans=s[i],ok=1;
  if(ok) cout<<ans;
  else cout<<-1;
  return 0;
}

#include <iostream>
#include <string>
using namespace std;
int main()
{
    string str;
    cin >> str;
    int sz = -1;
    bool f = false;
    while(str[sz+1])
    {
        sz++;
        if(str[sz] == '4' || str[sz] == '7')
            f=true;
    }
    if(f)
    {
        for(int i=sz/2;str[i];i++)
            if(str[i] == '4')
            {
                cout << '4';
                break;
            }
            else if(str[i] =='7')
            {
                cout << '7';
                break;
            }
    }
    else
        cout << "-1";
    cout << endl;
    return   0;
}

#include<bits/stdc++.h>

using namespace std;

#define pb  					push_back
#define mp 						make_pair
#define all(v) 					((v).begin()) ,((v).end())
#define let(o,v)				memset(o,v,sizeof (o))
typedef long long 				ll;
typedef vector<int>				vi;
typedef vector<vi>				vvi;
typedef vector<string>			vs;

const int MOD = (int)1e9 + 7;
const int oo = (int)1e9;
const ll OO = (ll)1e18;
const double PI = acos(-1.0);
const int N = (int)1e5 + 9;

bool prime[N];

bool isprime(int n)
{
	if (n <= 1)
		return 0;
	for (int i = 2; i*i <= n; i++)
	if (n%i == 0)
		return false;
	return  prime[n] = true;
}
void feilprime()
{
	prime[0] = prime[1] = 0;
	for (int i = 2; i*i <= 100009; i++)
	{
		if (isprime(i))
		for (int j = i + i; j<100009; j += i)
			prime[j] = 0;
	}
}

int n, a[1000005], b[1000005];

int main()
{
	//clock_t  ts = clock();
#ifndef ONLINE_JUDGE
	freopen("ttt.txt", "r", stdin);
#endif
	int ans = -1, mx = 0 ,st=-1 ;
	char h[55];
	scanf("%s", h);
	int sz = strlen(h);
	int c = 0;
	for (int i = 0; i < sz; i++)
	{
		if (h[i] == '4' || h[i] == '7')
		{
			c++;
			if (c == 1)
				st = h[i] == '4' ? 4 : 7;
			if (c > mx)
			{
				mx = c;
				ans = st;
			}
			else if (c == mx && st == 4)
				ans = 4;
		}
		else
			c = 0;
	}
	printf("%d\n", ans);
	return 0;
}

#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
using namespace std;
map<string,int>Map;
vector<pair<string,int> >record;

string withoutLeading0(string s){
	int i=0, cnt=s.size();
	while(s[i]=='0') i++,cnt--;
	return s.substr(i,cnt);
}

bool lucky(string s){
	if(s.size()==1) return (s[0] =='4' or s[0]=='7');
	for(int i=0;i<s.size();i++) if(!(s[i]=='4' or s[i]=='7')) return false;
	return true;
}

bool cmp(pair<string,int>p1, pair<string,int>p2){
	if(p1.second==p2.second) return p1.first.compare(p2.first) < 0;
	return p1.second > p2.second;
}

int main() {
	// your code goes here
	string n;
	cin>>n;
	int len = n.size();
	for(int i=0;i<len;i++){
		for(int j=1;i+j<=len;j++) {
			//printf("%s\n",n.substr(i,j).c_str());
			string tmp = n.substr(i,j);
			tmp = withoutLeading0(tmp);
			if(tmp.empty()) continue;
			if(lucky(tmp)) Map[tmp]++;
		}
	}

	for(auto p : Map){
		//printf("%s %d\n", p.first.c_str(),p.second);
		record.push_back(p);
	}
	sort(all(record),cmp);
	// for(int i=0;i<record.size();i++){
	// 	printf("%s %d\n", record[i].first.c_str(), record[i].second);
	// }

	printf("%s\n", record.empty() ? "-1" : record[0].first.c_str());
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    string s;
    ll i,j,k,n;
    cin>>s;
    j=-1;
    n=stoi(s);
    while(n)
    {
        if(n%10==4)
        {
            j=4;
            break;
        }
        else if(n%10==7)
            j=7;
        n/=10;
    }
    cout<<j;
}

#include <iostream>
#include <bits/stdc++.h>
#define int long long
using namespace std;

void solve()
{
    string s;
    int cnt_4=0, cnt_7=0,i;
    cin>>s;
    for(i=0; i<s.size(); i++)
    {
        if(s[i] == '4')
            cnt_4++;
        if(s[i] == '7')
            cnt_7++;
    }
    if(cnt_4 == 0 && cnt_7 ==0)
    {
        cout<<"0"<<endl;
        return;
    }
    if(cnt_4 < cnt_7)
    {
        cout<<"7"<<endl;
    }
    else
    {
        cout<<"4"<<endl;
    }

}
int32_t main() {
    int t=1;
    //cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}

/*Lucky Substring
Layla Hammoury
codeforces
20-8-2017*/

#include<iostream>
#include <string>
using namespace std;
int main()
{
	string str ;
	cin >> str;
	int c4=0;
	int c7=0;
	for(int u = 0;u<str.length() ; u++)
		 if(str[u]=='4')
			c4++;
		else
			if(str[u]=='7')
				c7++;

		if(c4 == 0,c7==0)
			cout<<"-1";
		else
			if(c4>=c7)
				cout<<"4";
			else cout<<"7";

//	system ("pause");
    return 0;
}

#include <functional>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <climits>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <list>
#include <set>
#include <map>
using namespace std;
const int Mod=101;
const int NN=1010;
const int Inf=0x7f7f7f7f;
typedef vector <int> VI;
typedef pair<int,int> pii;
template<class Int> int size(const Int &a){return (int)a.size();}
template<class Int> void contFract(Int m,Int n,vector<Int> &ans){while(n){ans.push_back(m/n);m%=n;m^=n^=m^=n;}}
template<class Int> Int Powmod( Int b, long long p, Int m = 0 ){Int r=1;for(long long i=(1ll<<62);i;i>>=1){r*=r; if(m>0)r%=m;if(p&i){r*=b;if(m>0)r%=m;}}return r;}
template<class Int> void factor(Int n,vector<Int> &v){Int sq=Int(sqrt((double)n));for(Int i=2;i<=sq;i++){if(n%i)continue;v.push_back(i);n/=i--;sq=Int(sqrt((double)n));}if(n>1)v.push_back(n);}
template<class Int> Int powmod(Int b,Int p,Int m=0){vector<bool>bits;while(p>0){Int np=p>>1;bits.push_back(np+np!=p);p=np;}Int r=1;for(int i=size(bits)-1;i>=0;i--){r*=r;if(m>0)r%=m;if(bits[i]){r*=b;if(m>0)r%=m;}}return r;}
template<class Int> Int divisors(Int n){vector<Int> f;factor(n,f);int k=size(f);vector<Int> table(k+1,Int(0));table[k]=Int(1);for(int i=k-1;i>=0;i--){table[i]=table[i+1];for(int j=i+1;;j++)if(j==k||f[j]!=f[i]){table[i]+=table[j];break;}}return table[0];}
#define MP  make_pair
main()
{
  ios::sync_with_stdio(false);
  string x;
  cin>>x;
  if(x.find('4')==-1 || x.find('7')==-1)puts("-1");
  int cnts[2];
  for(int i=0;i<size(x);i++)
    if(x[i]=='4')cnts[0]++;
    else if(x[i]=='7')cnts[1]++;
  if(cnts[0]>=cnts[1])puts("4");
  else puts("7");
}

#include <iostream>
#include <string>
using namespace std;

int main() {
    string str;
    int count4=0, count7=0;
    cin >> str;

    for(int i=0; i < str.size(); i++) {
        if(str[i] == '4')
            count4++;
        if(str[i] == '7')
            count7++;
    }

    if(count4 <= count7)
        cout << 4;
    else
        cout << 7;
    cout << endl;
}

#include <iostream>
#include <string>
using namespace std;
bool ishappy (int a)
{
	while (a)
	{
		if (!(a % 10 == 4 || a % 10 == 7))
			return false;
		a /= 10;
	}
	return true;
}
int main()
{
	//freopen ("input.txt","r",stdin);
	string s;
	cin >> s;
	int cnt4 = 0,cnt7 = 0;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == '4')
			cnt4++;
		if (s[i] == '7')
			cnt7++;

	}
	if (cnt4 == 0 && cnt7 == 0)
		puts ("-1");
	if (cnt4 >= cnt7)
		puts ("4");
	else
		puts ("7");
	return 0;
}

#include <bits/stdc++.h>

#define all(v)              ((v).begin()), ((v).end())
#define allr(v)             ((v).rbegin()), ((v).rend())
#define sz(v)               ((int)((v).size()))
#define clr(v, d)           memset(v, d, sizeof(v))
#define MP                  make_pair
#define lpv(i, v)           for(int i=0;i<sz(v);++i)
#define lpn(i, n)           for(int i=0;i<(int)(n);++i)
#define PI                  3.14159265359
#define pb                  push_back

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double LD;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;

inline ll GCD(ll a, ll b)
{
	if (a > b)
		swap(a, b);
	if (a == 0)
		return b;
	else
		return GCD(a, b % a);
}
inline bool isprime(ll x)
{
	if (x == 2)
		return true;
	if (x % 2 == 0 || x < 2)
		return false;
	for (int i = 3; i * i <= x; i += 2)
		if (x % i == 0)
			return false;
	return true;
}
void openfile()
{
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
}
int main()
{
	string s;
	cin >> s;
	int mx1 = INT_MIN, mx2 = INT_MIN;
	if (s.find('7') == -1 && s.find('4') == -1)
	{
		cout << -1<<endl;
		exit(0);
	}
	else
	{
		for (int i = 0; i<sz(s); i++)
		{
			int ans1 = 0, ans2 = 0;
			if (s[i] == '7')
			{
				for (int j = i + 1; j < sz(s); j++)
					if (s[j] == '7' || s[j] == '4')
						ans1++;
					else
						break;
			}
			else if (s[i] == '4')
				for (int j = i + 1; j < sz(s); j++)
					if (s[j] == '7' || s[j] == '4')
						ans2++;
					else
						break;
			mx1 = max(mx1, ans1);
			mx2 = max(mx2, ans2);
		}
	}
	mx1>mx2 ? cout << 7 : cout << 4;
	cout << endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define int long long int

#define vi vector<int>
#define F first
#define S second

#define For(b) for(int i=0;i<b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define gr greater<int>()
#define all(x) x.begin(),x.end()

void print()  {    cout<<endl;  }
void printarray()  {    return;  }
void scan() { return; }

template<typename T , typename... Args>  void print(T a , Args... arg)    {    cout << a << " " ;    print(arg...);    }

template<typename T , typename... Args> void scan(T &a , Args&... arg) {   cin >> a;   scan(arg...);   }

template<typename T,typename... Args> void scan(vector<T>&v , Args&... arg) {  for(auto &i : v)  cin>>i;  scan(arg...);  }

template<typename T,typename... Args> void printarray(vector<T>&v, Args&... arg) {   for(auto i : v)     cout<<i<<" ";   cout<<endl;    printarray(arg...);    }

int isprime(int x) {

    for(int i=2;i<=x/2;i++)
    {
        if(x%i==0){

            return 0;
        }

    }
    return 1;

}

int gcd(int a ,int b) {
    if(b==0)
      return a;
    return gcd(b,a%b);
}

void solve()
{

  string s;cin >> s;
  int n=s.length();

  int f=0,se=0;

  for(int i=0;s[i];i++)
  {

    if(s[i]=='4') f++;
    if(s[i]=='7') se++;
  }

  if(f==0 && se==0)
  {
    cout<<"-1\n";

  }
  if(f==se && f!=0)
  {
    cout<<"4\n";

  }
  if(se>f)
  {
    cout<<"7\n";

  }

}

int32_t main(){

   ios::sync_with_stdio(0);
   cin.tie(0); cout.tie(0);

  // int t;
 //  cin >> t;
  // for(int i=1;i<=t;i++)
 //  {
    //  cout<<"case # :"<< i <<" =  ";
      solve();
 //  }

    return 0;
}

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#define lld long long int
#define DBG1(vari1) cerr<<#vari1<<" = "<<(vari1)<<endl;
#define DBG2(vari1,vari2) cerr<<#vari1<<" = "<<(vari1)<<" "<<#vari2<<" = "<<(vari2)<<endl;
#define DBG3(vari1,vari2,vari3) cerr<<#vari1<<" = "<<(vari1)<<" "<<#vari2<<" = "<<(vari2)<<" "<<#vari3<<" = "<<(vari3)<<endl;
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	// freopen("input.txt", "r", stdin);
	string s;
	cin >> s;
	map <char,int> m;
	for(int i=0;i<s.size();i++)
	{
		m[s[i]]++;
	}
	if(m['4']==0&&m['7']==0)
		cout << "-1";
	else if(m['4']>m['7'])
		cout << "4";
	else
		cout << "7";
}

#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
//void truncate(int * );
using namespace std;
void truncate(char *);
int main()
{
	char a[50];

	int i;
	for(i=0;i<50;i++)
	{
		a[i]='a';
	}
	//int s[50];
	//scanf("%s",a);
	gets(a);
	truncate(a);

	return 0;

}
void  truncate(char *b)
{
            char *ptr;
			char d[50];
			int l;
			for(l=0;l<50;l++)
			{
				d[49-l]=b[l];
			}
            ptr=d;
            int count=0;
            while(*ptr==0||*ptr=='a')
            {
                ptr++;
				if(*ptr==0)
				{
                count++;
				}
            }
			/*
			if(count>0)
			{
				printf("-1\n",count);
				return;
			}*/
            char c[50-count];
            int j;
            for(j=0;j<(50-count);j++)
            {
                c[j]=*ptr;
                ptr++;
              //  printf("%c",c[j]);
            }
			//printf("\n");
			int nofour,noseven=0,boom=0;
			for(j=0;j<(50-count);j++)
			{
				if(c[j]=='4' )
				{
					nofour++;
				}
				else if(c[j]== '7')
				{
					noseven++;
				}
				else
				{
					boom++;
				}
			}
			if(boom==(50-count))
			{
				printf("-1");
				return  ;
			}
			else
			{
				if(nofour>=noseven)
				{
					printf("4");
					return ;
				}
				else
				{
					printf("7");
					return ;
				}
			}
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	long long int a=0,b=0,c=0,d=0;
	;
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++){
	if(s[i]=='4'||s[i]==7)c=1;
	if(s[i]=='4'&&d==0)a++,d=4;
	else if(s[i]=='4')a++;
	if(s[i]=='7'&&d==0)b++,d=7;
	else if(s[i]=='7')b++;
	}
	if(c==0)cout<<-1;
	else if(a>b)cout<<4;
	else if(b>a)cout<<7;
	else if(d==4)cout<<4;
	else cout<<7;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    cin>>str;
    int four=0,seven=0;
    for(int i=0;i<str.length();i++){
        if(str[i]=='4'){
            four++;
            break;
        }else if(str[i]=='7'){
            seven++;
        }
    }
    if(four+seven>0){
        if(four>seven){
            cout<<4<<endl;
        }else{
            cout<<7<<endl;
        }
    }else{
        cout<<-1<<endl;
    }
}

#include <iostream>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <set>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <list>
#include <fstream>
#define ull unsigned long long
#define ll long long
#define ld long double
#define pi 3.1415926536
#define lp(i,n,a) for(ll i=a;i<=n;i++)
#define pl(i,n) for(ll i=n-1;i>=0;i--)
#define w while
#define re return
// Hard Training :D
// hossam yehia //
using namespace std;
ll n, c, maxi, cnt, check;
string s, k, f, stpn;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> s;
	n = s.size();
	lp(i, n - 1, 0){
		lp(j, n - 1, i){
			k.push_back(s[j]);
			f = s;
			c = check = 0;
			cnt = k.size();
			lp(h, cnt - 1, 0){
				if (k[h] != '4' && k[h] != '7')
					check++;
			}
			if (!check){
				w(f.find(k) != -1){
					c++;
					if (c >= maxi)
						maxi = c, stpn = k;
					f[f.find(k)] = '#';
				}
			}
		}
		k.clear();
	}
	if (stpn.size())
		cout << stpn << endl;
	else
		cout << "-1\n";
	cin >> n;
	re 0;
}

//abo  masteriiiiii
#include<iostream>
using namespace std;
int main(){
    int k=0,l=0;
    string a;
    cin>>a;
    for(int i=0;i<a.size();i++)
                        {
        if(a[i]=='7')
            l++;
        else if(a[i]=='4')
            k++;
                     }
            if(k==l)
            cout<<4<<endl;
        if(k>l)
            cout<<4<<endl;
        if(k<l)
            cout<<7<<endl;
    else
        cout<<-1<<endl;
       //system("pause");
}

#include <iostream>
#include <bits/stdc++.h>
#include <unordered_map>
#include <string>
using namespace std;

#define pb push_back
#define ull unsigned long long
#define ll long long
#define F first
#define S second
#define PI acos(-1)
#define EPS 1e-9
#define BASE 31ll
#define BASE2 53ll
#define ld double
#define MAX 1000000000
#define NIL 0
#define INF 1e15
#define infi 1e16
#define rd(a) scanf("%d",&a)
#define rd2(a,b) scanf("%d %d",&a,&b)
#define rd3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define rdll(a) scanf("%I64d",&a)
#define sz(a) (int) a.size()
#define lp(i,a,n) for(int i=(a); i<=(n) ; ++i)
#define lpd(i,n,a) for(int i=(n); i>=(a) ; --i)
#define pi acos(-1)
#define lc (x << 1)
#define rc (x << 1 | 1)
#define cp(a,b)                 ( (conj(a)*(b)).imag() )	// a*b sin(T), if zero -> parllel
#define dp(a,b)                 ( (conj(a)*(b)).real() )	// a*b cos(T), if zero -> prep
#define angle(a)                (atan2((a).imag(), (a).real()))
#define X real()
#define Y imag()
#define vec(a,b)                ((b)-(a))

typedef complex<double>point;
typedef complex<double>CX;
typedef pair<ll,ll>ii;
typedef pair<ll,ii>jj;
typedef pair<vector<int>,int>vii;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

const int N=500005;

ll mod=1000000007;
ll mod2=1000000009;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
bool is_vowel(char c){if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')return 1;return 0;}
ld getDistance(ld x1,ld y1,ld x2,ld y2){return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}
ll extended_euclidean(ll a,ll b,ll &x,ll &y){if(b==0){x=1;y=0;return a;}ll g = extended_euclidean(b,a%b,y,x);y -= (a/b)*x;return g;}
ll power(ll base,ll p){if(p==1)return base;if(!p)return 1ll;ll ret=power(base,p/2);ret*=ret;ret%=mod;if(p&1)ret*=base;return ret%mod;}

int cnt[10];
int main() {
  //freopen("test.in","r",stdin);
 string s;
 cin>>s;
 lp(i,0,(int)s.length()-1)cnt[s[i]-'0']++;
 if(cnt[4]>=cnt[7])cout<<4;
 else if(cnt[7])cout<<7;
 else cout<<-1;
 return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
    long long i,cnt,MAX=0;
    string st;
    char s;
    cin>>st;
    i=0;
    while(st[i]!='\0')
    {
        cnt=0;
        while(st[i]=='4'||st[i]=='7'||st[i]!='\0')
        {
            cnt++;
            i++;
        }
        if(cnt>MAX)
        {
            MAX=cnt;
            s=st[i-cnt+1];
        }
        i++;
    }
    if(MAX==0)
        cout<<-1;
    else
        cout<<s;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    vector<int>v(10,0);
    cin>>s;
    for(int i=0;i<s.size();i++){
        int k;
        string st;
        st=s[i];
        stringstream ss(st);
        ss>>k;
        v[k]++;
    }
    int mx1=max(v[4],v[7]);
    int mx2=max(mx1,v[0]);

    if(mx1<mx2) cout<<-1<<endl;
    else if(v[4]==v[7]){
        cout<<(v[4]>0?4:-1);
    }
    else{
        int x=v[4],y=v[7],z;
        z=max(x,y);
        cout<<(x==z?4:7);
    }
    return 0;
}

#include <iostream>
#include <string>

using namespace std;

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	string S;
	cin >> S;
	int four = 0, seven = 0;
	for (int i = 0; i < S.length(); i++)
	{
		if (S[i] == '4')
			four++;
		if (S[i] == '7')
			seven++;
	}
	if (seven > four)
		cout << '7';
	if (four <= seven)
		cout << '4';
	if (four == 0 && seven == 0)
		cout << "-1";

	return 0;
}

#include<bits\stdc++.h>
using namespace std;
int main()
{
    char ara[3464],str[4843],ara2[8745],ch;
    scanf("%s",ara2);
    int ln,i,j,k=0;
    ln=strlen(ara2);
    for(i=0; i<ln; i++)
    {
        if(ara2[i]!='0')
        {
            str[k]=ara2[i];
            k++;
        }
    }
    strcpy(ara,str);
    for(i=0;i<k;i++)
	{   ch=str[0];
		for(j=0;j<k-1;j++)
		{
			str[j]=str[j+1];
		}
		str[j]=ch;
		int a;
		a=strcmp(ara,str);
		if(a>0)
		{
			strcpy(ara,str);
		}

	}
	int x,y,flag=0;
	for(j=0;j<k;j++)
	{
		if(ara[j]=='4'||ara[j]=='7')
		{
			x=ara[j]-48;
			flag=1;
			break;
		}

	}
	for(j=k-1;j>=0;j--)
	{
		if(ara[j]=='4'||ara[j]=='7')
		{
			y=ara[j]-48;
			flag=1;
			break;
		}

	}
	if(x>=y&&flag==1)
	{
		printf("%d\n",y);
		return 0;
	}
	if(x<=y&&flag==1)
	{
		printf("%d\n",x);
		return 0;
	}

	printf("-1\n");

    return 0;
}

//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <set>
#include <cmath>
#include <math.h>
#include <map>
#include <string>
#include <vector>
#define li int
#define lc char
#define ls string
#define r_0 return 0
#define pb push_back
#define ll long long
#define ld long double
using namespace std;
set <ll > se ;
vector <int >   v ,  v1,v2,v3;
const ll N=1e5+7 ;
const ll M=1e6+7 ;
const ll MOD=1e7+7 ;
const ll DIV=1e8+7 ;
const ll K=1e9+7 ;
ll n  , ans,sum, mn=10000000,y,mx,m, z,i , b[N],cnt1 , cur    , d   ,e ,r  , a  , c ;
string s1,s2,s3, s4, s5 , s,g,h;
ll  cnt    ;
char l , f ;
map <string , string> mp ;
int main()
{
    vector <char > v(101) , v1(101) ;
//freopen("standard.in" , "r" , stdin);
//freopen("standard.out" , "w" , stdout);
    cin >> s;
  for (ll i = 0 ; i <s.size ( ) ;  i ++ )  {
      if (s[i]=='4'){cnt ++ ; l='4' ;  }
      if (s[i]=='7'){ans ++ ; f='7' ;  ; }

    }
    if (cnt==0 and ans==0 ) {
        cout << -1 << endl  ;
    }
    else
    if (cnt==ans ) { cout << l << endl ; return 0 ; }
    if (cnt==0 and ans==0 ) {
        cout << -1 << endl ;
        return 0 ;
    }
   if (cnt >ans) {
        cout << l << endl ;
        return 0  ;
    }
    else if (ans >cnt){
        cout << f << endl ;
        return 0 ;
       }
    else
    {
        cout << -1 << endl ;
    }

}

#include <algorithm>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

bool isL(int x) {
	int dig;
	while(x) {
		dig = x%10;
		x /= 10;
		if(dig == 7 || dig == 4);
		else return false;
	}
	return true;
}

string str;

int main() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin );
	//freopen("ou.txt", "w", stdout);
#endif
	int a = 0, b = 0;
	cin >> str;

	for(int i = 0; i < (int)str.size(); ++i) {
		if(str[i] == '4') a++;
		if(str[i] == '7') b++;
	}

	if(!a && !b)		puts("-1");
	if(a >= b)	cout << "4";
	else		cout << "7";

	return 0;
}

#include <bits/stdc++.h>
#include <algorithm>
#include <iterator>
#include<cmath>
using namespace std;
#define ll long long
#define mod 1000000007
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL);
#define tc int tc; cin >> tc; while (tc--)
#define pb push_back
#define mp make_pair
#define r_0 return 0
#define FOR(i, n) for (int i = 1; i <= int(n); i++)
using namespace std;

int main()
{
    fio
    string s;
    cin>>s;
   // getline(cin,s);
    int cnt4=0,cnt7=0;
   for (auto i : s){
      if(s[i]=='4'){
          cnt4++;
      }
      if(s[i]=='7'){
          cnt7++;
      }
   }
   if((cnt4==0)&&(cnt7==0)){
       cout<<1;
   }
   else if(cnt4>=cnt7){
           cout<<4;
       }
   else
       {
           cout<<7;
       }
return 0;
}

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
	string c;
	cin >> c;
	int k = 0, l = 0;
	for (int i = 0; i < c.size(); i++) {
		if (c[i] == '4') {
			k++;
		}
		if (c[i] == '7') {
			l++;
		}
	}
	if (k > l) {
		cout << 4;
	}
	else if(k!=0){
		cout << 7;
	}
	else {
		cout << -1;
	}
	//system("pause");
	return 0;
}

#include <bits/stdc++.h>
#define ll long long
#include<algorithm>
#include<iostream>
using namespace std;

int main()
{
      ios_base::sync_with_stdio(false);
    cin.tie(NULL);
string s;
cin>>s;
int p=0;
bool k =false;
for(int i=0;i<s.length();i++)
{
    if(s.at(i)==4)
    {
        p++;
       k=false;
    }
    else if(s.at(i)==7)
    {
     p--;

    }
}

if(p=0&&k)
    cout<<-1;
else if(p>=0)
    cout<<4;
else
 cout<<7;
}

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

void main()
{
	string s;
	cin >> s;
	int count4 = 0, count7 = 0;

	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == '4')
			count4++;
		else if (s[i] == '7')
			count7++;
	}

	if (count4 == 0 && count7 == 0)
		 cout << "-1" << endl;

	else if (count4 <= count7)
		cout << '7' << endl;

	else if (count4 > count7)
		cout << '4' << endl;

}

#include <iostream>
#include <string>

using namespace std;

int main(){
	string s;
	cin >> s;
	int l = s.length();

	int c4=0;
	int c7=0;

	for(int i=0;i<l;i++)
		if(s[i]=='4') c4++;
		else if(s[i]=='7') c7++;

	if (!c4 && !c7) {
		cout << -1;
	}else if (c7>c4){
		cout << 4;
	}else{
		cout << 7;
	}

	return 0;
}

#include <stdio.h>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
#include <string>
int max(int k, int b){
    if(k>b){
        return k;
    } else {
        return b;
    }
}
int a[ 1000007 ]  ,d[ 1000007] ;
void solve(int n){
    int a = 0, b = 0 ,i ,s=0 ,j ,kol=0 ;
    char c[60];
    gets(c);
    for(i=0;i<strlen(c);i++){
        if(c[i]=='4'){
            a++;
        }
        if(c[i]=='7'){
            b++;
        }
    }
    if(a==0&&b==0){
        printf("-1");
    }else{
        if(a>b){
            printf("4");
        }else{
            printf("7");
        }
    }
}
int main() {
    #pragma comment(linker, "/STACK:67108864")
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
    #endif
    int a = 0, b = 0 ,i ,s=0 ,j ,kol=0 ;
    char c[60];
    gets(c);
    for(i=0;i<strlen(c);i++){
        if(c[i]=='4'){
            a++;
        }
        if(c[i]=='7'){
            b++;
        }
    }
    if(a==0&&b==0){
        printf("-1");
    }else{
        if(a>b){
            printf("4");
        }else{
            printf("7");
        }
    }
    return 0;
}

//abo  masteriiiiii
#include<iostream>
using namespace std;
int main(){
    int k=0,l=0;
    string a;
    cin>>a;
    for(int i=0;i<a.size();i++)
                        {
        if(a[i]=='7')
            l++;
        else if(a[i]=='4')
            k++;
                     }
        if(k>l)
            cout<<4<<endl;
        if(k<l)
            cout<<7<<endl;
    else
        cout<<-1<<endl;
       //system("pause");
}

#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	int c=0,w=0;
	string x;
	cin>>x;
	for(int i=0;i<x.length();i++){
	if(x[i]=='7')
	 	c++;
    if(x[i]=='4')
		w++;
	}
if(c>w)
	cout<<'7'<<endl;
else{
	if(c==w&&c!=0&&w!=0){
		int y=x.find('7');
		int z=x.find('4');
		if(y>z)
		cout<<'4'<<endl;
		else
		cout<<'7'<<endl;
	}
	else{
		if(w>c)
	 	cout<<'4'<<endl;
		else
			cout<<-1;

	}

}
}

#include<bits/stdc++.h>
using namespace std;
string st;
int i;
int main(){
	cin>>st;
	for(i=0; i<st.size(); i++)
	if(st[i]=='4') {
		cout<<4;
		return 0;
	}
	for(i=0; i<st.size(); i++)
	if(st[i]=='7') {
		cout<<7;
		return 0;
	}
	cout<<-1;
	return 0;
}

// 2.cpp : Defines the entry point for the console application.
//

//#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <math.h>
#include <vector>
#define pi  3.14159265358979323846

using namespace std;

void main()
{
    bool p1=0;
    int c1=0;
    bool p2=0;
    int c2=0;
    char c;
    while (cin.get(c))
    {
        if (c=='4')
        {
            p1=1;
            c1++;
        }
        else if (c=='7')
        {
            p2=1;
            c2++;
        }
    }

    if (!p1 && !p2)
        cout<<"-1";
    else if (c1>c2)
        cout<<"4";
    else
        cout<<"7";

//    getch();
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	string str;
	cin>>str;
	if(count(str.begin(),str.end(),'4')==0  && count(str.begin(),str.end(),'7')==0)
	   {
	    cout<<"-1\n";
	     return 0;
	  }
	int x=count(str.begin(),str.end(),'4');
	int y=count(str.begin(),str.end(),'7');
	x>y?cout<<"4\n":cout<<"7\n";
   return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
typedef pair<int,int> pii;
typedef pair <long long,long long> pll;
typedef long long ll;
typedef long double ld;
const ll mod = 1e9+7;
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
	string s; cin >>s;
	int a = 0, b = 0;
	for(char x: s){
		if(x == '4')
			a++;
		else if(x =='7')
			b++;
	}
	if(a == b == 0)
		cout<<-1;
	else if(a >= b)
		cout<<4;
	else
		cout<<7;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

bool isLucky(int n) {
	if (n == 0) {
		return false;
	}
	while (n) {
		if (n % 10 != 4 && n % 10 != 7) {
			return false;
		}
		n /= 10;
	}
	return true;
}

bool isLucky(string s) {
	for (int i = 0; i < s.size(); ++i) {
		if (s[i] != '4' && s[i] != '7') {
			return false;
		}
	}
	return true;
}

int main() {
	map < string, int > M;
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); ++i) {
		for (int j = 1; j + i <= s.size(); ++j) {
			if (isLucky(s.substr(i, j))) {
				++M[s.substr(i, j)];
			}
		}
	}
	vector < pair < int, string > > u;
	for (map < string, int > ::iterator it = M.begin(); it != M.end(); ++it) {
		u.push_back(make_pair(it->second, it->first));
	}
	sort(u.begin(), u.end());
	if (u.size() == 0) {
		cout << -1 << endl;
	} else {
		cout << u[0].second << endl;
	}
	return 0;
}

#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

main(){
	string s;
	cin>>s;
	int cnt4=0,cnt7=0,fst=0,pre=-1;
	int n;
	n=s.length();
	for(int i=0;i<s.length();i++){
		if(isdigit(s[i])){
			char ch;
			ch=s[i];
			if(ch=='4'){
			cnt4++;
			if(fst==0 && s[i+1]=='7' && i<n-1){
				pre=4;
				fst=1;
			}
			if(fst==0 && i==n-1){
				pre=4;
				fst=1;
			}

			}
			else if(ch=='7' ){
			cnt7++;
			if(fst==0 && s[i+1]=='4' && i<n-1){
				pre=7;
				fst=1;
			}
			if(fst==0 && i==n-1){
				pre=7;
				fst=1;
			}
			}
		}
	}
		if(cnt4==cnt7){
			cout<<pre;
		}
		else if(cnt4!=cnt7){
			if(cnt4>cnt7)
			cout<<'4';
			else
			cout<<'7';
		}

}

#include<bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
// #define int cpp_int
using namespace std;

#define fastio 			ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int 			long long
#define ll 				long long
#define ld 				long double
#define vi 				vector<int>
#define pii 			pair<int,int>
#define vpii 			vector< pair<int,int> >
#define uset			unordered_set
#define umap 			unordered_map
#define maxpq 			priority_queue<int>
#define minpq			priority_queue<int,vi,greater<int>()>

#define all(v) 			v.begin(),v.end()
#define part(v,s,e)		v.begin()+s,v.begin()+e
#define rev(v)			reverse(v.begin(),v.end())
#define sz(x)			(int)x.size()
#define def(v)			memset(v,-1,sizeof(v));
#define def0(v)			memset(v,0,sizeof(v));
#define minv(a)			*min_element(all(a))
#define maxv(a)			*max_element(all(a))
#define sumv(a)			accumulate(all(a),0)

#define	lb				lower_bound
#define	ub				upper_bound
#define	desc			greater<int>()
#define	pb				emplace_back
#define	mp				make_pair
#define	F				first
#define	S				second

#define	mod 			1000000007
#define	inf 			1000000000000000
#define infty			1000000000000000000LL
#define	md				998244353
#define	PI				acos(-1.0)
#define	endl 			"\n"
#define	rr				return
#define	br				cout<<"\n";

#define gcd(a,b)		__gcd(a,b)
#define lcm(a,b)		(a/(__gcd(a,b)))*b

#define setbits(x) 		__builtin_popcountll(x)
#define zerobits(x)		__builtin_ctzll(x)

#define ip(v)	 		for(auto& i:v)	cin>>i;
#define op(v) 			for(auto i:v)	cout<<i<<" ";cout<<endl;
#define deb(x) 			cout <<"Value of " #x << " : " << x << endl;

void solve()
{

	string s;
	cin>>s;

	int cnt4=0,cnt7=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='4')
			cnt4++;
		else if(s[i]=='7')
			cnt7++;
	}

	if(cnt4==0 and cnt7==0)
	{
		cout<<"-1\n";
	}
	else if(cnt4<=cnt7 & cnt4)
	{
		cout<<"4\n";
	}
	else if(cnt7)
	{
		cout<<"7\n";
	}

}

int32_t main()
{

	fastio
	cout<<setprecision(15)<<fixed;

	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	// int t; cin>>t; while(t--)
	solve();

	#ifndef ONLINE_JUDGE
		cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
	#endif

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define eb emplace_back
#define pi 3.1415926536

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    string s; cin>>s;  int c1=0,c2=0;
    for(int i=0;i<s.length();i++){
        if(s[i]=='4')c1++;
        else if(s[i]=='7')c2++;
    }
    if(c1>=c2)cout<<"4";
    else cout<<"7";
}

#include<bits/stdc++.h>
#define ll long long int
using namespace std;

int main(){
string s;cin>>s;
int for1=0,seven=0;
for(char ch:s)
if(ch=='4') for1++;
else seven++;
if(for1==seven&&for1==0)cout<<"-1\n";
else if(for1>seven)
cout<<"4"<<endl;
else cout<<"7"<<endl;

return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int arr[2];
int main()
{
      int temp ;
     string s; cin >> s;
     int x=s.length();
     for(int i=0 ;i<x;++i)
     {
           if(s[i] == '4')
           ++arr[0];
           if(s[i] == '7')
           ++arr[1];
     }
     if((arr[0] == 0 && arr[1] == 0) || (s[0]-48 > 7))
     {printf("-1"); return 0;}

     temp=(arr[0] > arr[1])?4:7;
     for(int i=0 ;i<x;++i)
     {
           if((s[i]-48) == temp)
           continue;
           else if((s[i]-48) > temp)
           {printf("-1"); return 0;}
           else
           {printf("%d",temp); return 0;}
     }

    return 0;
}

#include <bits/stdc++.h>

using namespace std;
#define f(k,n) for (int k=0;k<n;k++)
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define inf 2e9
#define i64 __int64
#define pii pair<int,int>
#define mp(x,y) make_pair(x,y)
#define sqr(a) ((a)*(a))
#define eps 1e-4
bool isLucky(string a) {
    for (char c : a)
        if (c !='4' && c != '7') return false;
    return true;
}
int countSubs(string a, string b) {
    int t = 0;
    for (int i = 0; i<=a.length()-b.length(); i++)
        if (a.substr(i,b.length()) == b) t++;
    return t;
}
bool isOk(string s) {
    return (s[0] != '0' && s.length()>0);
}
int main() {

    ios_base::sync_with_stdio(false); cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    string s, res;
    int cnt = 0;
    cin>>s;
    for (int i = 0; i<s.length(); i++)
        for (int j = i+1; j<s.length()+1; j++) {
            string t = s.substr(i,j-i);
            if (isOk(t) && isLucky(t)) {
                int tn = countSubs(s,t);
                if (tn > cnt) {
                    cnt = tn;
                    res = t;
                }
            }
        }
    cout << res;
}

#pragma comment(linker, "/STACK:64000000")
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <ctime>
#include <sstream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define ft first
#define st second
#define mp make_pair
#define pb push_back
#define sz(n) int(n.size())
#define all(n) n.begin(), n.end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

const int N = 1e5 + 123;
const int inf = 1e9 + 7;
const ll INF = 1e18 + 7;

string s;

int main ()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> s;
	int fours = 0, sevens = 0;
	for (int i = 0; i < sz(s); i ++)
	{
		if (s[i] == '4')
		{
			fours ++;
		}
	}
	for (int i = 0; i < sz(s); i ++)
	{
		if (s[i] == '7')
		{
			sevens ++;
		}
	}

	if (!fours && !sevens) cout << -1;
	if (fours >= sevens) cout << 4;
	else cout << 7;
}

#include <iostream>
#include<algorithm>
#include<string>
#include<map>
#include <iterator>
#include<iomanip>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<stdio.h>
#include<set>
#include <functional>

#define mod 1000000007
#define mod2 30000000
#define pa(a,b) make_pair(a,b)
#define f first
#define s second
#define pb(a)  push_back(a)
#define all(a) a.begin() , a.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define LL  long long int
#define oo 1e9
#define pi 3.14159265359
#define eps  1e-9

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

LL maxx(LL a , LL b){ return a>b ?  a : b ;}
LL minn(LL a , LL b){ return a>b ?  b : a ;}

using namespace std;
int dx[] = {1 , 1 ,1 , 0 , 0  , -1 , -1  , -1  , 0 };
int dy[] = { -1 , 0  , 1 , 1 , -1 , 0 , 1 , -1 , 0 };
void boostIO()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
LL gcd(LL a, LL b) {
    return b == 0 ? a : gcd(b, a % b);
}
LL lcm(LL a , LL b )
{
    return (a*b)/gcd(a , b);
}
LL poww(LL base, LL exp){
  base %= mod;
  LL result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % mod;
    base = (base * base) % mod;
    exp >>= 1;
  }
  return result;
}
map<string , int > mp ;
int main()
{
    string s ; cin >> s ;
    string ans = "" ;
    for(int i = 0 ; i < s.size() ; i++){
        string temp = "" ;
        for(int j = i ; j < s.size() ; j++){
            temp = temp + s[j] ;
            if(s[j] == '4' || s[j] == '7'){
                mp[temp]++ ;
            }
            break;
        }
    }
    auto it = mp.begin() ;
    int mx = 0 ;
    for(; it != mp.end() ; it++){
            if(it -> second >= mx){
                mx = it -> second  ;
                if(ans.size() == 0){
                    ans = it -> first ;
                }
                ans = min(ans , it -> first) ;
            }
    }
    cout << (ans.empty() ? "-1" : ans) << endl ;
    return 0 ;
}

#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <math.h>
#include <map>
#include <queue>

using namespace std;

long long n,x,i,k4=0,k7=0;
string s;
long ans;

int main(){
    cin>>s;
    for(i=0;i<s.length();i++)
      if(s[i]=='4'){k4++;}
      else if(s[i]==7){k7++;}
      if(k4==0||k7==0)cout<<-1;
      if(k4>k7||k4==k7)cout<<4;else cout<<7;
 return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
string s;
cin>>s;
int c4 = count (begin(s), end(s), '4');
int c7 = count (begin(s), end(s), '7');
if (c4>0)
{
    cout<<"4";
    return 0;
}
else
{
cout << "7";
return 0;
}
    cout<<"-1";
}

/* Fri Nov 01 2019 20:08:17 GMT+0300 (MSK) */

/* Fri Nov 01 2019 20:11:28 GMT+0300 (MSK) */

#include <iostream>
using namespace std;

int main() {
    string s;
    cin>>s;
    int n=0,m=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='4')
        n++;
        if(s[i]=='7')
        m++;
    }
   // cout<<m<<" "<<n<<" ";
    if(n>m){
        cout<<"4";
    } else if(m<n){
        cout<<"7";
    } else if(m==n&&m!=0){
        cout<<"4";
    } else{
        cout<<"-1";
    }
	return 0;
}

#include <iostream>
#include <string>
#include <array>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <vector>
# define ll long long
using namespace std;

int main(int argc, const char * argv[]) {

    string digits ;
    int  notLucky =0  , se7en = 0 ,fou4 = 0;
    cin >> digits ;
    for (int i = 0 ; i < digits.length(); i++) {
        if (digits[i] != '4' && digits[i]!='7')
            notLucky++ ;

        if (digits[i] == '4' || digits[i] == '7'){
            notLucky-- ;
            if (digits[i]=='7')
                se7en++ ;

            if (digits[i]=='4')
                fou4++ ;

        }
    }
    if (notLucky > 0)
        cout << -1 ;
    else{
        if (se7en > fou4){
            cout << "7" ;
        }else if (fou4 > se7en){
            cout<<"4" ;
        }else{
            cout <<"4" ;
        }
    }

    return 0 ;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    bool f=0;
    bool se=0;
    int cnt4=0,cnt7=0;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {

        if(s[i]=='4'&&se==0)
        {
            cnt4++;
            f=1;
        }
        else if(s[i]=='4') cnt4++;
        else if(s[i]=='7')
        {
            cnt7++;
            se=1;
        }
    }
    if(cnt4==0&&cnt7==0) cout<<"-1"<<endl;
    else if(cnt4>cnt7) cout<<"4"<<endl;
    else if(cnt7>cnt4) cout<<"7"<<endl;
    else if(cnt4==cnt7)
    {
        if(f==1) cout<<"4"<<endl;
        else cout<<"7"<<endl;
    }
    return 0;
}

#include<stdio.h>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define MOD 1000000007
int f,c;
bool criba[100010];
int cols[505],rows[505];
int n,m,arr[505][505],voy,res;

int main(){
    criba[1]=criba[0]=true;
    voy=2;
    while (voy*voy<=100009){
        for (int i=2*voy;i<100009;i+=voy)
            criba[i]=true;
        voy++;
        while (criba[voy] && voy*voy<=100009)
            voy++;
    }
    /*for (int i=1;i<=20;i++)
        if (!criba[i])
            printf("%d\n",i);*/
    scanf("%d%d",&n,&m);
    for (int i=0;i<n;i++){
        for (int j=0;j<m;j++)
            scanf("%d",&arr[i][j]);
    }
    for (int i=0;i<n;i++){
        for (int j=0;j<m;j++){
            while (criba[arr[i][j]]){
                arr[i][j]++;
                rows[i]++;
                cols[j]++;
            }
        }
    }
    res=cols[0];
    for (int i=0;i<n;i++)
        res=min(res,rows[i]);
    for (int j=0;j<m;j++)
        res=min(res,cols[j]);
    printf("%d\n",res);
	return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <fstream>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <sstream>
#include <deque>
#include <utility>
#include <bitset>

using namespace std;

int main() {
    int n;
    scanf("%d",&n);
    int arr[10];
    memset(arr,0,sizeof(arr));

    stringstream iss;
    iss<<n;
    string s = iss.str();

    for (int i = 0; i < s.size(); ++i)
        arr[s[i]-'0']++;

    if (arr[4] > arr[7])
        cout<<4<<endl;
    else if  (arr[4] < arr[7])
        cout<<7<<endl;
    else
        cout<<-1<<endl;

    return 0;
}

#include<iostream>
#include<string>
using namespace std;
int main()
{
    string s;
    cin >> s;
    int max1 = 0, max2 = 0;
    int n = 0, m = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == '4')
        {
            n++;
            max2 = m;
            m = 0;
        }
        else if (s[i] == '7')
        {
            m++;
            max1 = n;
            n = 0;
        }
    }
    if (max1 == 0 && max2 == 0)
        cout << -1;
    if (max1 >= max2)
        cout << 4;
    else
        cout << 7;
    return 0;

}

#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
   int a=  count(s.begin(),s.end(),'4');
   int b = count(s.begin(),s.end(),'4');
   if(a==0 && b==0){
       cout<<"-1";
   }
   else{
       if(a>=b){
           cout<<"4";
       }
       else{
           cout<<"7";
       }

   }
}

#include "bits/stdc++.h"
using namespace std;
//https://codeforces.com/problemset/problem/122/B

int main()
{
    string str; cin >> str;
    map<char, int> myMap;

    for(size_t i = 0; i < str.length(); i++)
    {
        if(str[i] == '7')
            myMap[str[i]]++;

        else if(str[i] == '4')
            myMap[str[i]]++;
    }

    if(myMap['7'] > myMap['4'])
        cout << 7 << endl;

    else if(myMap['7'] <= myMap['4'])
        cout << 4 << endl;

    else
        cout << -1 << endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main(){
  string s;
  cin >> s;

  unordered_map<string, int> cnt;
  string result = "";
  int max_occur = 0;
  string current = "";
  for(int i = 0; i < s.size(); i++){
    if(s[i] == '4' || s[i] == '7'){
      current += s[i];

      for(int j = 0; j < current.size(); j++){
        for(int k = 1; k <= current.size()-j; k++){
          string sub = current.substr(j,k);
          cnt[sub]++;
          if(cnt[sub] > max_occur){
            result = sub;
            max_occur = cnt[sub];
          } else if(cnt[sub] == max_occur && sub < result){
            result = sub;
          }
        }
      }
    } else{
      current = "";
    }
  }

  if(result.empty()){
    cout << -1 << endl;
  } else{
    cout << result << endl;
  }

  return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main(){
    string s;
    cin >>s;

    int a, b;
    a = b = 0;
    for(int i = 0;i<s.length();i++){
        if(s[i] == '4'){
            a++;
        }
        if(s[i] == '7'){
            b++;
        }
    }
    if(a == 0 && b == 0){
        cout <<-1;
        return 0;
    }
    int i = 0;
    int j = 1;
    unordered_map<string, int> m;
    int max= INT_MIN;
    string result = "";
    while(i < s.length()){
        if((s[i] == '4' || s[i] == '7') && (s[j] == '4' || s[j] == '7')){
            while(j < s.length() && (s[j] == '4' || s[j] == '7')){
                j++;
            }
            string x = s.substr(i, j - i);
            m[x]++;
            i = j;
            j = i + 1;
            if(m[x] > max){
            max=  m[x];
            result = x;
            }
            if(m[x] == max){
                result = min(result, x);
            }
        }
        else{
            i++;
            j++;
        }
    }

    if(a > max){
        result = "4";
    }
    if(a == max){
        string x = "4";
        result = min(result, x);
    }
    if(b > max){
        result = "7";
    }
    if(b == max){
        string x = "7";
        result = min(result, x);
    }
    cout <<result<<endl;
    return 0;
}

#include <stdio.h>
using namespace std;
int main()
{
    char str[64];
    scanf("%s",str);
    int f[8]={0};
    for(int i=0;str[i];++i)
        if(str[i]=='4' || str[i]=='7')
            ++f[str[i]-'0'];
    if(str[4]>=str[7])
        putchar('4');
    else
        putchar('7');
    return 0;
}

#include <iostream>
using namespace std;
int main() {
   string s;
   cin>>s;
   int n=s.length();
   int x;
   int countfo=0,countse=0;
   for(int i=0;i<n;i++){
  x=s[i]-'0';
  if(x==4){
      countfo++;

    }
    else if(x==7){
        countse++;
    }

   }
   if(countse>countfo){
       cout<<7;
   }
   else if(countfo>=countse){
       cout<<4;
   }
   else
   cout<<-1;
}