You can iterate over the characters in the input string and add the position to an array which you can return.
An other possible solutions is to use regular expressions