Getting WA on Test case 0. rest all correct

Here is my code. https://send.firefox.com/download/5096dbd3feeb7721/#p94aSmqHoftuq-EccypgiQ .
I tried to run this code on a non space version( in which string consisted of only lowercase letters and no space) and it ran quite good. I don’t know what I am doing wrong for the space version

your code
fails for the following test

casejshbjahbcdsjdnocloidfhibdckadlivcnsnksonjshsbdinihgbl.sksjsocksbuhbfeuyrefeujsjdhbhsscaodainabshgblocbsjasbk
codingblocks

req answer
caodainabshgblocbsjasbk

ur s
cnsnksonjshsbdinihgbl.sksjsoc