Sum Numbers Embedded in a String

Given a string s, return the sum of all non-negative decimal integers embedded in it. Consecutive digits form one number. For example, "ab12cd3" contains the…

Given a string `s`, return the sum of all non-negative decimal integers embedded in it. Consecutive digits form one number. For example, `"ab12cd3"` contains the numbers `12` and `3`, so the answer is `15`. If the string contains no digits, return `0`.

- `0 ≤ s.length ≤ 10^4` - `s` contains printable ASCII characters. - Every embedded integer and the final sum fit in a signed 32-bit integer. - The interactive visualizer accepts at most 40 characters; longer valid judge inputs remain execution-only.

Example 1: input s = "ab12cd3"; output 15. The embedded numbers are 12 and 3.

Example 2: input s = "7apples30mangoes"; output 37. The embedded numbers are 7 and 30.

Example 3: input s = "no digits"; output 0. No decimal number occurs in the string.

Category: Strings. Topic: strings. Difficulty: Easy. Patterns: string-processing.