runtime error sigsegv

when i run it on ideone the code runs successfully but spoj gives me runtime error sigsegv can somebody tell what is wrong with my code

SIGSEGV is an error caused by an invalid memory reference or segmentation fault.

ReCheck your while loop

	while( != 'N'){
	out +=; 

When there is only 1 element in ā€˜sā€™ i.e. for the last iteration

and after you


ā€˜sā€™ becomes empty.

thus in the next line points to an invalid memory.

Hope this helps.

If this solution solves your problem kindly Accept it using the tick option below the downvote button. Happy coding :slight_smile: