Problem 4 solved

created a function to count the number of characters in the string