매일매일개발/Codewars
codewars #75 Numericals of a String (6kyu)
개하싶
2018. 7. 9. 17:34
You are given an input string.
For each symbol in the string if it's the first character occurence, replace it with a '1', else replace it with the amount of times you've already seen it...
But will your code be performant enough?
Examples:
input = "Hello, World!"
result = "1112111121311"
input = "aaaaaaaaaaaa"
result = "123456789101112"
Note: there will be no int domain overflow (character occurences will be less than 2 billion).