Problem code- ITGUY15
This code is working everywhere but codechef is showing runtime error and I am not able to find the reason for this so please help.
https://www.codechef.com/PBK12020/problems/ITGUY15
#include<bits/stdc++.h>
#include
using namespace std;
void recur(string s)
{
vector <char> v;
int flag=0;
for(int i=0;i<s.length();i++)
{
v.push_back(s[i]);
}
vector<char>::iterator it1,it2;
it1=v.begin();
for(int i=0;i<v.size();i++)
{
if((v[i]=='a')&&(v[i+1]=='b')&&(v[i+2]=='c'))
{
it1+=i;
it2=it1+3;
v.erase(it1,it2);
flag=1;
}
}
if(flag==0)
{
cout<<s<<endl;
return;
}
string str="";
for(int i=0;i<v.size();i++)
str+=v[i];
v.clear();
recur(str);
}
int main()
{
int t;
cin>>t;
while(t--)
{
string s;
cin>>s;
recur(s);
}
return 0;
}