In the town of Digitania, there lived a librarian named Lydia. She was not just any librarian; she had a unique gift for decoding hidden patterns and solving intricate puzzles hidden in texts. One day, Lydia received an ancient scroll from a distant land. The scroll contained a single string: "a123bc34d8ef34". The note attached to the scroll read: "Discover the unique treasures hidden within."

Lydia knew this was no ordinary string; it was a challenge meant for her. She sat at her desk, unfurled the scroll, and examined the string closely. Her task was to uncover the number of unique integers hidden within it.

We decide to help Lydia decode any scroll like that. In other words, we have to develop an algorithm that finds the number of different integers within a string between any characters. Two integers are considered different if their decimal representations without any leading zeros are different.

In a123bc34d8ef34 we find 123, 8 and 34, thus we should return 3.

Input Format

The first line contains , the number of strings to decode Then lines follows, containing all the strings

Constraints

  • every string consists of positive integral numbers and lowercase letters
  • every string is at most 1000 characters long
  • every contiguous number fits 32bit size

Output Format

For each string, the number of unique integers within it

Sample Input 0

1
a123bc34d8ef34

Sample Output 0

3

Explanation 0

We find 123, 8, 34 and 34. Since 34 is duplicated, it counts only as one. Thus the answer is 3.

Sample Input 1

2
coding0145gym145rocks2024
abcdefghilmno

Sample Output 1

2
0

Explanation 1

0145 and 145 are the same number, then we find 2024. Thus the answer is 2.

The second string does not contain any numbers.

Line: 1 Col: 1
  1. Challenge Walkthrough
    Let's walk through this sample challenge and explore the features of the code editor.1 of 6
  2. Review the problem statement
    Each challenge has a problem statement that includes sample inputs and outputs. Some challenges include additional information to help you out.2 of 6
  3. Choose a language
    Select the language you wish to use to solve this challenge.3 of 6
  4. Enter your code
    Code your solution in our custom editor or code in your own environment and upload your solution as a file.4 of 6
  5. Test your code
    You can compile your code and test it for errors and accuracy before submitting.5 of 6
  6. Submit to see results
    When you're ready, submit your solution! Remember, you can go back and refine your code anytime.6 of 6
  1. Check your score