program slapta_kalba;
{ 152 u‘davinys }
  var liet, slap, zodis: string;
      teis: boolean;

  function didz (r: char): char;
  { raidŠ perražo did‘i…j… raide }
  begin
    if r in ['', '€', '‹', '', '­', 'Ÿ', '§', '¦', '’']
       then didz := r
       else if not (r in ['…', '‡', 'Š', '‚', '', 'ž', '—', '–'])
               then didz := upcase (r)
               else case r of
                      '…': didz := '';
                      '‡': didz := '€';
                      'Š': didz := '‹';
                      '‚': didz := '';
                      '': didz := '­';
                      'ž': didz := 'Ÿ';
                      '—': didz := '§';
                      '–': didz := '¦';
                      '‘': didz := '’';
                     end
  end; { did‘ }

  function teis_zodis (lt, sl: string): boolean;
  { tikrina, ar teisingai ižverstas ‘odis }
    var pradzia, pabaiga: string;
        i: integer;
        pavyko: boolean;
  begin
    { ‘od‘ius perražome did‘iosiomis raid‚mis }
    for i := 1 to length(lt) do
      begin
         lt[i] := didz (lt[i]);
         sl[i] := didz (sl[i]);
      end;
    { ‘od‘i—, turin‡i— vien… raidŠ keisti nereikia }
    pavyko := (length(lt) = 1) and (lt = sl);
    i := 1;
    while not pavyko and (i < length(lt)) do
      begin
        { ‘od suskaidome  dvi dalis }
        pradzia := copy (sl, 1, i);
        pabaiga := copy (sl, i+1, length(sl)-i);
        pavyko := lt = (pabaiga+pradzia);
        i := i + 1;
      end;
    teis_zodis := pavyko;
  end; { teis_‘odis }

  procedure vertimas (liet, slap: string;
                      var teis: boolean; { ar teisingai ižversta }
                      var zodis: string { klaidingas ‘odis });
    var tarpas: integer;
        lt, sl: string;
  begin
    { tažkus sakini— gale pakei‡iame tarpais }
    liet := copy (liet, 1, length(liet) - 1) + ' ';
    slap := copy (slap, 1, length(slap) - 1) + ' ';
    teis := true;
    while (length(liet) > 0) and teis do
      { kol neper‘i–r‚ti visi ‘od‘iai ir nerasta klaid— }
      begin
        { imame vien… lietuvižk… ‘od }
        tarpas :=  pos(' ', liet);
        lt := copy (liet, 1, tarpas-1);
        delete (liet, 1, tarpas);
        { imame vien… ižverst… ‘od }
        tarpas :=  pos(' ', slap);
        sl := copy (slap, 1, tarpas-1);
        delete (slap, 1, tarpas);
        if length(lt) <> length(sl)
           then teis := false
           else teis := teis_zodis (lt, sl)
      end;
    if not teis
       then zodis := lt;
  end; { vertimas }

begin
  readln (liet);
  readln (slap);
  vertimas (liet, slap, teis, zodis);
  if teis
     then writeln ('Vertimas teisingas')
     else writeln ('Klaidingai ižverstas ‘odis: ', zodis)
end.
