my code- https://ide.codingblocks.com/s/35346
Problem - http://codeforces.com/contest/118/submission/44530600
This is problem number 118 A at codeforces.
String manipulation - Getting runtime error on a paticular test case
Runtime error is due to illegal accessing of the index of the array or string.
In your code, you have not mentioned size for s2, and also while accessing the elements of the strings in the for loops, your code doesn’t work well for very larger input.
So it shows run time error.
I am using an integer j which is getting incremented by 1 everytime a character is added to string s2.
Also can you please tell what could be a more optimised way so that it does not show run time error?
http://codeforces.com/contest/118/submission/44935626
Here is an optimised solution .
This works on codechef ide but not on codeforces.