Skip to content
Onsite

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

Run checks the 3 visible tests, Submit all 10.