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).
'매일매일개발 > Codewars' 카테고리의 다른 글
codewars #77 Tortoise racing (6kyu) (0) | 2018.07.11 |
---|---|
codewars #76 Ones and Zeros (7kyu) (0) | 2018.07.10 |
codewars #74 CamelCase to underscore(6kyu) (0) | 2018.07.06 |
codewars #73 Counting Duplicates (6kyu) (0) | 2018.07.05 |
codewars #72 Moving Zeros To The End (5kyu) (0) | 2018.07.04 |