Getting floating point error

question-https://www.interviewbit.com/problems/stringoholics/

code-https://ide.codingblocks.com/s/118151
please tell how to remove,

when you are erasing from string then insure that string is not empty