program Project2; {$APPTYPE CONSOLE} uses SysUtils; var z:set of char; {ch,ch1:char;} i,j:integer; b,t:boolean; a:array[0..501]of char; begin assign(input,'text.in'); reset(input); assign(output,'text.out'); rewrite(output); i:=0; {z:=z+['.']+['?']+['!'];} b:=false; t:=false; while not eoln do begin inc(i); read(a[i]); end; for j:=1 to i do begin {read(ch);} {if i=0 then begin if not(ch in['a'..'z'])then i:=1 else i:=2; end else if i=1 then begin if (not(ch in['A'..'Z'])) then else i:=2; end else if (ch='.')or(ch='!')or(ch='?')then i:=0; if i=2 then begin if ch in['A'..'Z']then write(chr(ord(ch)+32))else if ch in['a'..'z'] then write(chr(ord(ch)-32)) end else write(ch); {write(ord('A'),' ',ord('a'));} if (a[j] in ['A'..'Z'])and(a[j+1] in ['A'..'Z'])then b:=true; if (a[j+1] in ['A'..'Z'])and(a[j] in ['a'..'z'])then begin b:=true; if (a[j-1]in['A'..'Z'])or(a[j-1]in ['a'..'z']) then t:=true;end; if (b)and(not(t))and((a[j]in ['A'..'Z'])or(a[j]in ['a'..'z'])) then begin if a[j] in['A'..'Z']then write(chr(ord(a[j])+32))else if a[j] in['a'..'z'] then write(chr(ord(a[j])-32))end else write(a[j]); if t then t:=false; {ch1:=ch;} end; close(input); close(output); end.