#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define irep(i, n) for(int i = n-1; i >= (int)0; i--)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;

int main(){
    string s;
    std::cin >> s;
    std::cout << s.substr(0,s.size()-8) << std::endl;
}
/*#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };


int H = 0;
int M = 0;
int S = 0;

void input(void) {
	CI H >> M >> S;

	return;
}


int main(void) {
	int sum = 0;
	int remain = 0;
	int hour = 0;
	int minute = 0;
	int second = 0;

	while (1) {
		input();
		if (H == -1) {
			return 0;
		}
		sum = H * 3600 + M * 60 + S;
		remain = 2 * 3600 - sum;
		second = remain % 60;
		remain -= remain % 60;
		remain /= 60;
		minute = remain % 60;
		remain -= remain % 60;
		remain /= 60;
		hour = remain
	}

	return 0;
}*/
/*#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };


int H = 0;
int M = 0;
int S = 0;

void input(void) {
CI H >> M >> S;

return;
}


int main(void) {
int sum = 0;
int remain = 0;
int hour = 0;
int minute = 0;
int second = 0;

while (1) {
input();
if (H == -1) {
return 0;
}
sum = H * 3600 + M * 60 + S;
remain = 2 * 3600 - sum;
second = remain % 60;
remain -= remain % 60;
remain /= 60;
minute = remain % 60;
remain -= remain % 60;
remain /= 60;
hour = remain
}

return 0;
}*/

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;



int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };



const long long int III = 1000010;

string str;
void input(void) {
	CI str;
	return;
}


int main(void) {
	input();
	long long int f_j = 0;
	long long int f_o = 0;
	long long int f_i = 0;

	long long int max_k = 0;for (int i = 0; i < str.size(); i++) {
		if (str[i] == 'J') {
			if (f_o == 0 && f_i == 0) {
				f_j++;
			}
			if (f_o != 0 || f_i != 0) {
				f_j = 1;
				f_o = 0;
				f_i = 0;
			}
		}
		else {
			if (f_j > 0 && f_o != f_j && f_i == 0 && str[i] == 'O') {
				f_o++;
			}
			else {
				if (f_o > 0 && f_i != f_o && str[i] == 'I') {
					f_i++;
					if (f_j >= f_o && f_o == f_i) {
						if (f_o > max_k) {
							max_k = f_o;
						}
						f_j = 0;
						f_o = 0;
						f_i = 0;
					}
				}
				else {

					f_j = 0;
					f_o = 0;
					f_i = 0;

				}
			}
		}
	}

	CO max_k E


	return 0;
}