Run time eroor on CB IDE

I have submitted my solution
#include
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
int len=s.size();
int f[1005];
for(int i=0;i<len;i++)
{
int cs=1;
for(int j=i+1;j<len;j++)
{
if(s[j]==s[i])
{
cs++;
}
}
f[i]=cs;
}
int max1=f[0];
int ans;
for(int i=0;i<len;i++)
{
if(f[i]>max1)
{
max1=f[i];
ans=i;
}
}
cout<<s[ans];
return 0;
}
this to problem MAX FREQUENCY CHARACTER and i am getting run time error in three cases in CB IDE whereas in other IDE’s it is working perfect.
Please tell my mistake;

@HarshGupta15122000 Please save your code on ide.codingblocks.com and share its link.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.