Eddie Awad,
Your solution will work only for single digit elements
what if the string has elements like 'abc','qwerty' etc ?