#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
string s;
void solve() {
  map<string, int> cnt;
  for (int i = 0; i < s.size(); i++)
    for (int j = i; j < s.size(); j++) {
      bool ok = true;
      for (int k = i; k <= j; k++)
        if (s[k] != '4' && s[k] != '7') ok = false;
      if (ok) cnt[s.substr(i, j - i + 1)]++;
    }
  if (cnt.size()) {
    int maxCnt = 0;
    string maxS;
    for (map<string, int>::iterator it = cnt.begin(); it != cnt.end(); it++)
      if (it->second > maxCnt) {
        maxCnt = it->second;
        maxS = it->first;
      }
    cout << maxS << endl;
  } else
    cout << -1 << endl;
}
int main() {
  while (cin >> s) solve();
}
