program Untitled;
var
s,g:string;
r:set of char;
i:byte;
begin
r:=['.',',','!'];
write(' enter string: '); reADLN(s); g:=s;
i:=1;
while i<=length (s) do begin
if s[i] in r then delete (s,i,1) else inc(i);
end;
writeln(s);
writeln(g);
readln
end.
var
s, g:string;
r: set of char;
i: byte;
begin
r:=['.',',','!'];
write(' enter string: '); readln(s);
g := '';
for i := 1 to length(s) do
if not(s[i] in r) then g := g + s[i];
writeln(s);
writeln(g);
readln
end.
{$X+}
uses crt;
Type
str=object
private
enterstr,resultstr:string;
public
procedure Init;
procedure RunAndDone;
end;
Procedure Str.Init;
begin
write('Enter string ');
readln(enterstr);
resultstr:='';
end;
procedure str.runanddone;
var
r:set of char; i:byte;
begin
r:=['.',',','!'];
i:=1;
for i := 1 to length(enterstr) do
if not(enterstr[i] in r) then resultstr:=resultstr+enterstr[i];
writeln(enterstr);
writeln(resultstr);
readln
end;
var
work:str;
begin
work.init;
work.runanddone;
end.
function is_punct(ch: char): boolean;
begin
is_punct := (ch in ['.',',','!'])
end;
function check_string(ch: char): string;
begin
check_string := '';
if not is_punct(ch) then check_string := ch;
end;
function do_it(s: string): string;
begin
if length(s) > 1 then
do_it := check_string(s[1]) + do_it( copy(s, 2, 255) )
else do_it := check_string(s[1]);
end;
var s, g: string;
begin
write('enter string: '); readln(s);
writeln( do_it(s) );
end.