-
Notifications
You must be signed in to change notification settings - Fork 1
/
otan.ts
47 lines (42 loc) · 917 Bytes
/
otan.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import * as readline from 'readline';
function Otan(): void {
const array: { [key: string]: string } = {
' ': ' ',
A: 'Alpha',
B: 'Bravo',
C: 'Charlie',
D: 'Delta',
E: 'Echo',
F: 'Foxtrot',
G: 'Golf',
H: 'Hotel',
I: 'India',
J: 'Juliet',
K: 'Kilo',
L: 'Lima',
M: 'Mike',
N: 'November',
O: 'Oscar',
P: 'Papa',
Q: 'Quebec',
R: 'Romeo',
S: 'Sierra',
T: 'Tango',
U: 'Uniform',
V: 'Victor',
W: 'Whiskey',
X: 'Xray',
Y: 'Yankee',
Z: 'Zulu',
};
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
rl.question('Ecrivez le texte à transcrire en OTAN : ', (otanInput) => {
rl.close();
const translate: string[] = otanInput.split('').map((char) => array[char.toUpperCase()] ?? char);
console.log('\n' + translate.join(' ') + '\n');
});
}
Otan();