Tap here to switch tabs
Problem
Submissions

Problem: Number of Different Integers in a String

Number of Different Integers in a String counts distinct integers created when letters split a string into digit sequences, with leading zeros ignored.

Statement

You are given a string word consisting of digits and lowercase English letters.

Replace every non digit character with a space, then separate the remaining contiguous digit sequences into integers. Two integers are considered equal if they evaluate to the same decimal value after ignoring leading zeros.

Return the number of unique integers in word.

Constraints:

  • 1≤1 \le word.length ≤1000\le 1000

  • word consists of digits and lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Different Integers in a String

Number of Different Integers in a String counts distinct integers created when letters split a string into digit sequences, with leading zeros ignored.

Statement

You are given a string word consisting of digits and lowercase English letters.

Replace every non digit character with a space, then separate the remaining contiguous digit sequences into integers. Two integers are considered equal if they evaluate to the same decimal value after ignoring leading zeros.

Return the number of unique integers in word.

Constraints:

  • 1≤1 \le word.length ≤1000\le 1000

  • word consists of digits and lowercase English letters.