educational codeforces round 19 problem c

Revision en1, by blowin_in_the_wind, 2017-04-16 12:43:31

getting runtime error on testcase 11

Exit code is -1073741819

here is my code:

include

include<string.h>

include

using namespace std; int main() { string lame=""; string a,b="",c=""; int i,j,n; getline(cin,a);

for(i=0;i<a.length();i++)
 b[i]=a[i];
 sort(a.begin(),a.end());j=0;

for(i=0;i<a.length();i++)
{
    if(b[i]!=a[j])
    {
           lame.push_back(b[i]);

    }
    else
    {
       c.push_back(a[j]);
       j++;
    }

}
if(lame.length()!=0)
{
    reverse(lame.begin(),lame.end());
c=c+lame;
}
cout<<c<<endl;
return 0;

}

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English blowin_in_the_wind 2017-04-16 12:45:58 5 Tiny change: ' code:\n\n#inclu' -> ' code:\n\n\n#inclu'
en1 English blowin_in_the_wind 2017-04-16 12:43:31 645 Initial revision (published)