use strict;
my @morse_table = qw(E T I A N M S U R W D K G O H V F Ü L Ä P J B X C Y Z Q Ö CH 5 4 S 3 É ^ Ð 2 ^ È + ^ Þ À J 1 6 = / ^ Ç ^ H ^ 7 ^ G Ñ 8 ^ 9 0 ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ? _ ^ ^ ^ ^ " ^ ^ . ^ ^ ^ ^ @ ^ ^ ^ ' ^ ^ - ^ ^ ^ ^ ^ ^ ^ ^ ; ! ^ \( ^ ^ ^ ^ ^ , ^ ^ ^ ^ : ^ ^ ^ ^ ^ ^ ^ );
my $index;
while(<>)
{
      chomp;
      for(split / +/)
      {
            $index=0;
            for(split //)
            {
                  if($_ eq "." or $_ eq "·")
                  {
                      $index=($index+1)*2-1;
                  }
                  elsif($_ eq "-" or $_ eq "—")
                  {
                      $index=($index+1)*2;
                  }
                  else
                  {
                      print " ";
                      $index=0;
                  }
            }
            print @morse_table[$index-1] if $index>0;
            $index=0;
      }
      print $/;
}
