You are given a string s consisting of lowercase English letters. s may contain valid concatenated English words representing the digits 0 to 9, without spaces.
Your task is to extract each valid number word in order and convert it to its corresponding digit, producing a string of digits.
Parse s from left to right. At each position:
Return the resulting digit string. If no number words are found, return an empty string.
Example 1:
Input: s = "onefourthree"
Output: "143"
Explanation:
"143".Example 2:
Input: s = "ninexsix"
Output: "96"
Explanation:
"nine" is a valid number word and maps to 9."x" does not match any valid number word prefix and is skipped."six" is a valid number word and maps to 6, so the final result is "96".Example 3:
Input: s = "zeero"
Output: ""
Explanation:
Example 4:
Input: s = "tw"
Output: ""
Explanation:
Constraints:
1 <= s.length <= 105s contains only lowercase English letters.Loading editor...
"onefourthree"