Skip to content

Tag: character

Doubling one letter with each new occurence

so I have task to double number of letter “a” every time it occurs in a string. For example sentence “a cat walked on the road” , at the end must be “aa caaaat waaaaaaaalked on the roaaaaaaaaaaaaaaaa” . I had something like this on my mind but it doubles every charachter, not only “a”. Answer You need to check