At the line number 20 which says
for (i = s.length(); i >=0 ; --i)
it should rather be i = s.length() - 1 because end of array of length n is n-1 rather than n
Maybe it will help you. You can refer to our site with this problem. There you can get a quick and qualitative answer. By the way, this is the best website to buy essays and there is round-the-clock support.