#include <bits/stdc++.h>
using namespace std;
bool isLucky(string w) {
  for (int i = 0; i < (int)w.length(); i++) {
    if (w[i] != '4' && w[i] != '7') return false;
  }
  return true;
}
int contar(string w, string chk) {
  int ans = 0;
  size_t pos = 0;
  while ((pos = w.find(chk, pos)) != string::npos) {
    ans++;
    pos++;
  }
  return ans;
}
int main() {
  int contagem = 0;
  string w, ans;
  cin >> w;
  for (int i = 0; i < (int)w.length(); i++) {
    for (int j = i + 1; j <= (int)w.length(); j++) {
      string chk = w.substr(i, j - i);
      if (isLucky(chk) && contar(w, chk) >= contagem) {
        if (contar(w, chk) == contagem)
          ans = min(ans, chk);
        else
          ans = chk;
        contagem = contar(w, chk);
      }
    }
  }
  cout << (ans.empty() ? "-1" : ans) << '\n';
  return 0;
}
