Number of fiscal identification P67511


Statement
 

pdf   zip

html

Write a program that reads a sequence of numbers of identity card (DNIs) and prints them adding their letter corresponding to the number of fiscal identification (NIF).

To compute the NIF letter, you must compute the remainder of divide the number of DNI by 23 and use the following correspondence:

||
0T
1R
2W
3A
4G
5M
6Y
7F
8P
9D
10X
11B
12N
13J
14Z
15S
16Q
17V
18H
19L
20C
21K
22E
||

Input

Input is a sequence of DNI numbers (positive integer numbers with eight or less digits).

Output

For each DNI number of the input, print it in a line with exactly eight digits and adding its letter corresponding to the NIF separated by a dash.

Observation

Use a function to return the letter corresponding to every number between 0 and 22. Use a function number_of_digits() that computes the number of digits of a number and use it to print the zeros on the left.

Public test cases
  • Input

    12345678
    99999999
    1234567
    666
    

    Output

    12345678-Z
    99999999-R
    01234567-L
    00000666-E
    
  • Information
    Author
    Jordi Petit
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++