Problem 2

{type str80=string[80] is defined elsewhere}

1: Function wxzs (aLine:Str80):Str80;
2:Const 
3:	markerlimit=4;
4:
5:var
6:	markerCount:0..markerlimit;
7:	marker:Set of Char;
8:	Place:0..80;
9:	
10:	begin
11:		marker:=['%','*','%','&'];
12:		markerCount:=0;
13:		Place:=1;
14:		repeat
15:			if aLine[Place]=marker then 
16:				begin
17:					markerCount:=markerCount+1;
18:					aLine:=copy(aLine,Place+1,length(aLine)-Place);
19:					Place:=1
20:				end
21:			else Place:=Place+1
22:		until (markerCount=markerlimit) or (length(aLine)=Place-1);
23:		wxzs:=aLine
24:	end;

Assume the call: 
inLine:=wxzs('asdf&asdf*aer%asdf$asdf*aypto');
writeln(inLine);