#include <bits/stdc++.h>
using namespace std;
bool islucky(string s) {
  for (int i = 0; i < (int)s.size(); ++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 + (int)p.size() - 1 < (int)s.size(); ++i) {
    string aux = s.substr(i, (int)p.size());
    if (p == aux) ++cnt;
  }
  return cnt;
}
string solve(string s) {
  int aux = -1;
  string ans;
  for (int i = 0; i < (int)s.size(); ++i) {
    for (int j = 1; j < (int)s.size() - 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";
}
