#include <bits/stdc.h++>
#define NMAX 200001
#define KMAX 15
#define pb push_back
#define MOD 1000000007
#define nl '\n'
#define INF 0x3f3f3f3f
#define pii1 pair<int, pair<int,int>> (1,(1,2));
#define pii pair<int,int>
#define tpl tuple<int, int,int,int>
#define int long long
using namespace std;
ifstream fin("data.in");
ofstream fout("data.out");
int n,k;
string s;
signed main() {
cin>>n>>k;
cin>>s;
int mini=INF;
for(int i=0;i<s.size();++i)
{
int sum=0;
bool ok=false;
if(s[i]=='J')
{
int cntJ=1,cntO=0,cntI=0;
for(int j=i+1;j<s.size();++j)
{
if(cntJ==k && cntO==k && cntI==k) {
ok=true;
break;
}
if(s[j]=='J'&& cntJ<k)
{
cntJ++;
}
else if(s[j]=='J'&& cntJ==k)
sum++;
if(s[j]=='O'&& cntJ==k && cntO<k)
{
cntO++;
}
else if(s[j]=='O'&& cntO==k)
sum++;
if(s[j]=='I'&& cntJ==k && cntO==k && cntI<k)
cntI++;
else if(s[j]=='I'&& cntO<k)
sum++;
}
}
if(ok)
mini=min(mini,sum);
}
if(mini=INF)
cout<<-1;
else
cout<<mini;
return 0;
}
Compilation message
ho_t2.cpp:1:10: fatal error: bits/stdc.h++: No such file or directory
1 | #include <bits/stdc.h++>
| ^~~~~~~~~~~~~~~
compilation terminated.