Skip to content
Onsite

Digits Before Letters

EasyP3Coding

s contains only digits and lowercase letters. Return a string made of all its digits first, then all its letters, each group in the same relative order as in s.

Example 1

Input
s = "r1h4l"
Output
"14rhl"

Example 2

Input
s = "abc"
Output
"abc"

Example 3

Input
s = "123"
Output
"123"

Constraints

  • 1 <= s.length <= 10^5
  • s contains only digits 0-9 and lowercase letters a-z.

Hints

Run checks the 3 visible tests, Submit all 11.