#include <bits/stdc++.h>
using namespace std;
char s[1000];
string s1;
vector<string> a;
int main() {
  gets(s);
  string s1 = string(s);
  int N = strlen(s);
  for (int i = 0; i < N; i++) {
    string s0 = "";
    if (s[i] == '4' || s[i] == '7') {
      s0 = s[i];
      a.push_back(s0);
    } else
      continue;
    for (int j = i + 1; j < N; j++) {
      if (s[j] == '4' || s[j] == '7') {
        s0 += s[j];
        a.push_back(s0);
      } else
        break;
    }
  }
  int ans = 0;
  string sans = "";
  sort(a.begin(), a.end());
  a.push_back("");
  int p = 1;
  for (int i = 0; i < a.size() - 1; i++)
    if (a[i] == a[i + 1])
      p++;
    else {
      if (p > ans) {
        ans = p;
        sans = a[i];
      } else if (p == ans && a[i] < sans) {
        sans = ans;
      }
      p = 1;
    }
  if (sans == "")
    cout << -1 << endl;
  else
    cout << sans << endl;
  return 0;
}
