#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
map<string, int> m;
bool checker(string a, int n) {
  bool c = 1;
  for (int i = 0; i < n; i++) {
    if (a[i] == '4' || a[i] == '7') {
      continue;
    } else {
      c = 0;
      break;
    }
  }
  return c;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  int n = s.length();
  for (int i = 0; i < n; i++) {
    for (int j = 1; j < n - i + 1; j++) {
      string k = s.substr(i, j);
      bool a1 = checker(k, k.length());
      if (a1) {
        m[k]++;
      } else {
        break;
      }
    }
  }
  int max = -1;
  string f = "9";
  for (auto t : m) {
    if (max <= t.second) {
      max = t.second;
    }
  }
  for (auto t : m) {
    if (t.second == max) {
      if (f > t.first) {
        f = t.first;
      }
    }
  }
  if (f == "9") {
    cout << -1;
  } else {
    cout << f;
  }
}
