String to Letter Positions
EasyP3Coding
Replace each character of s with its 1-based position in the string, and return the positions written one after another with nothing between them. For abcd the result is 1234.
Positions of 10 and above contribute all their digits, so a string of length 11 gives 1234567891011.
Example 1
- Input
- s = "abcd"
- Output
- "1234"
Example 2
- Input
- s = "a"
- Output
- "1"
Example 3
- Input
- s = "zz"
- Output
- "12"
Constraints
- 1 <= s.length <= 1000
- s consists of lowercase letters.
Hints
Give it a real attempt first. Run shows which examples fail.
Saved automatically
Run checks the 3 visible tests, Submit all 10. ⌘Enter runs, ⌘⇧Enter submits.