#include <bits/stdc++.h>
using namespace std;
long double dist(long double x1, long double y1, long double x2,
                 long double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
bool cp(pair<int, string> a, pair<int, string> b) {
  if (a.first < b.first) {
    return true;
  } else {
    if (a.first > b.first) {
      return false;
    }
    if (a.first == b.first) {
      return a.second > b.second;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  map<string, int> p;
  for (int i = 0; i < s.size(); i++) {
    string y = "";
    y += s[i];
    if (y == "7" || y == "4") {
      p[y]++;
      for (int j = i + 1; j < s.size(); j++) {
        if (s[j] == '7' || s[j] == '4') {
          y += s[j];
          p[y]++;
        } else {
          break;
        }
      }
    }
  }
  vector<pair<int, string> > r;
  for (map<string, int>::iterator i = p.begin(); i != p.end(); i++) {
    r.push_back(make_pair(i->second, i->first));
  }
  sort(r.begin(), r.end(), cp);
  if (r.size() == 0) {
    cout << -1;
  } else {
    cout << r[r.size() - 1].second;
  }
}
