finished case a string function and added comments in code to understand whats going on in the particular function.