Tuenti Challenge 7

Challenge 8 - Uni code to rule them all

hieroglyph

We need to process lots of data. As a big problem with data is how you recollect it, one of the most important steps is cleaning and normalizing it.

In this case, we need to clean integers, just integers. We asked our data collectors to only use integers with decimal notation. We thought this would give us clean data… but that’s not the case, there are invalid numbers, and a lot of valid numbers with strange characters.

Please, help us to clean this data.

Input

The first line will contain an integer C, the number of cases for our problem.
Each case consists of a line with some characters. Some of them will be valid numbers. A number is valid if all its characters are decimal digits (Nd), and there are no other characters or spaces inside the number. Only one number is allowed per line. Spaces (Zs) are allowed at the beginning and end of each line.

Output

For each case, a line starting with "Case #x: " followed by the the number in hexadecimal format or, if the number is not valid, the string “N/A”. Every line is followed by a new line character.

Limits

  • 0 ≤ Number ≤ 104097 - 1
  • 1 ≤ Number of lines ≤ 250

Sample Input

11
12345
  12345  
  12345  a
   789꧔
123 45
1234abc  
٨8٩
۵ ۷
٦ମ2
O5
०5

Sample Output

Case #1: 3039
Case #2: 3039
Case #3: N/A
Case #4: 1ed6
Case #5: N/A
Case #6: N/A
Case #7: 379
Case #8: N/A
Case #9: N/A
Case #10: N/A
Case #11: 5

Test your code

You can test your program against both the input provided in the test phase and the input provided in the submit phase. A nice output will tell you if your program got the right solution or not. You can try as many times as you want to. Be careful with extra whitespaces, the output should be exactly as described.

Test your program against the input provided in the test phase

Download test input

Program output:

Test your program against the input provided in the submit phase

Download input

Program output:

During the submit phase, in some problems, we might give your program harder inputs. As with the test token, a nice output will tell you if your program got the right solution or not. You can try as many times as you need.

In the actual contest you first need to solve the test phase before submitting the code, you must provide the source code used to solve the challenge and you can only submit once (once your solution is submitted you won't be able to amend it to fix issues or make it faster).

If you have any doubts, please check the info section.