#include <bits/stdc++.h>
using namespace std;
vector<pair<int, string> > ans;
map<string, int> m;
string s;
bool check(string taken) {
  int checker = 0;
  for (int i = 0; i < taken.size(); i++) {
    if (taken[i] != '4' && taken[i] != '7') {
      checker = 1;
      break;
    }
  }
  return checker == 0;
}
int main() {
  cin >> s;
  int mx = 0;
  for (int i = 0; i < s.size(); i++) {
    string curr = "";
    for (int k = i; k < s.size(); k++) {
      curr += s[k];
      m[curr]++;
    }
  }
  map<string, int>::iterator it = m.begin();
  while (it != m.end()) {
    if (check(it->first)) ans.push_back({it->second, it->first});
    it++;
  }
  sort(ans.rbegin(), ans.rend());
  if (ans.size() == 0)
    cout << "-1" << endl;
  else {
    vector<string> res;
    mx = ans[0].first;
    for (int i = 0; i < ans.size(); i++) {
      if (ans[i].first == mx)
        res.push_back(ans[i].second);
      else
        break;
    }
    sort(res.begin(), res.end());
    cout << res[0] << endl;
  }
  return 0;
}
