#include <bits/stdc++.h>
using namespace std;
int main() {
  string x;
  map<string, int> c;
  while (cin >> x) {
    c.clear();
    int n = x.length();
    for (int l = 1; l <= n; l++) {
      for (int i = 0; i <= n - l; i++) {
        int flag = 1;
        for (int j = i; j < i + l; j++) {
          if (x[j] != '4' && x[j] != '7') {
            flag = 0;
            break;
          }
        }
        if (flag) {
          if (c.find(x.substr(i, l)) != c.end()) {
            c[x.substr(i, l)]++;
          } else {
            c[x.substr(i, l)] = 1;
          }
        }
      }
    }
    map<string, int>::iterator it;
    map<string, int>::iterator it1;
    int count = 0;
    int flag = 0;
    for (it = c.begin(); it != c.end(); it++) {
      if ((it->second) > count) {
        flag = 1;
        it1 = it;
        count = it->second;
      }
    }
    if (flag)
      cout << it1->first << endl;
    else
      cout << "-1" << endl;
  }
}
