#423

Reconstruct Original Digits from English

medium · verified · 52.7% accepted · 892 likes · top 43%

hash table · math · string

Description

Given a string s containing an out-of-order English representation of digits 0-9, return the digits in ascending order.

Example 1:

Input: s = "owoztneoer"
Output: "012"

Example 2:

Input: s = "fviefuro"
Output: "45"

Solution