Yesterday, I had participated in Google Kick Start and submitted my solution, but it show RE while sample cases are passed successfully.
I have also try my code on "ideone " for sample cases.
Anyone who find some error or bug in my code please make me it noted.
Problem Statement: https://codingcompetitions.withgoogle.com/kickstart/round/00000000001a0069/0000000000414bfb
My solution:
#include <bits/stdc++.h>
using namespace std;
int main(){
int tc,m,n,fs;
cin>>tc;
string s;
string s1="KICK",s2="START";
for(int i=0;i<tc;i++){
cin>>s;
m=0,n=0,fs=0;
for(int j=0;j<s.size()-3;j++)
{
if(s1.compare(s.substr(j,4)) == 0){
//cout<<s.substr(j,4)<<endl;
m++;
}
if(s2.compare(s.substr(j,5)) == 0 && j<s.size()-4){
//cout<<s.substr(j,5)<<endl;
n+=m;
}
}
cout<<"Case #"<<i+1<<": "<<n<<endl;
}
}