#!/usr/bin/env perl

use v5.34;
use warnings;
use feature 'signatures';
no warnings ('experimental::signatures');
use Getopt::Std ();

sub usage($fh) {
	print $fh <<~'EOF';
		Usage:
		  nato
		  nato -h
		EOF
}

sub help($fh) {
	print $fh <<~'EOF';


		Options:
		  -h, --help    show this message


		Translate the given input to the NATO phonetic alphabet.


		Examples:

		  Spell 'EuAndreh':

		    $ echo 'EuAndreh' | nato
		    Echo Uniform Alfa November Delta Romeo Echo Hotel
		EOF
}

for (@ARGV) {
	last if $_ eq '--';
	if ($_ eq '--help') {
		usage *STDOUT;
		help *STDOUT;
		exit
	}
}

my %opts;
if (!Getopt::Std::getopts('h', \%opts)) {
	usage *STDERR;
	exit 2;
}

if ($opts{h}) {
	usage *STDOUT;
	help *STDOUT;
	exit;
}

my %DICT = (
	'a' => 'Alfa',
	'b' => 'Bravo',
	'c' => 'Charlie',
	'd' => 'Delta',
	'e' => 'Echo',
	'f' => 'Foxtrot',
	'g' => 'Golf',
	'h' => 'Hotel',
	'i' => 'India',
	'j' => 'Juliett',
	'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' => 'X-ray',
	'y' => 'Yankee',
	'z' => 'Zulu',
	'1' => 'One',
	'2' => 'Two',
	'3' => 'Three',
	'4' => 'Four',
	'5' => 'Five',
	'6' => 'Six',
	'7' => 'Seven',
	'8' => 'Eight',
	'9' => 'Nine',
	'0' => 'Zero',
);

while (<STDIN>) {
	for my $c (split //, $_) {
		my $char = $DICT{lc $c};
		print "$char " if defined $char;
	}
	print "\n";
}
