
var F1, F2 : Text;
    C : char;
    Ufn : String[ 20 ];

BEGIN
  writeln( 'KOI-8-Cs -> ASCII converting program Vers. 1.0' ); writeln;
  write( 'Source file = ' ); readln( Ufn ); assign( F1, Ufn ); reset( F1 );
  write( 'Dest.  file = ' ); readln( Ufn ); assign( F2, Ufn ); rewrite( F2 );
  while not eof( F1 ) do
    begin
      read( F1, C );
      case chr( ord( C ) xor $80 ) of
        'w' : C := 'E';
        'W' : C := 'e';
        'j' : C := 'U';
        'J' : C := 'u';
        #0..#$7f : C := chr( ord( C ) xor $20 );
      end;
      C := chr( ord( C ) and $7f );
      write( F2, C );
    end;
  close( F2 );
END.
