#include <bits/stdc++.h>
using namespace std;
long long tono(string s) {
  int a = s.size();
  long long b = 0;
  for (int i = 0; i < a; i++) {
    b *= 10;
    b += (s[i] - 48);
  }
  return b;
}
map<long long, int> m;
int main() {
  string s;
  cin >> s;
  int ma = 0;
  long long k, q = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '4' || s[i] == '7') {
      string s1 = "";
      for (int j = 0; j < 10; j++) {
        if (!(s[i + j] == '7' || s[i + j] == '4')) break;
        s1 += s[i + j];
        k = tono(s1);
        m[k]++;
        if (m[k] > ma) {
          ma = m[k];
          q = k;
        }
      }
    }
  }
  if (q == 0) {
    cout << -1;
  } else {
    for (map<long long, int>::iterator it = m.begin(); it != m.end(); ++it) {
      if (it->second == ma) {
        if (it->first < q) q = it->first;
      }
    }
    cout << q;
  }
}
