Code of strings

I tried to solve codes of string problem, It is working fine for given sample input. But code is not getting accepted
Any suggestion or improvement
code link- : https://ide.codingblocks.com/s/173040

@SWIFTY
Give a space after each comma.