program A; uses SysUtils; var FIn : TextFile; FOut : TextFile; Line : String; Count : Integer; Arr : array of Boolean; LengthLn : Integer; StartLn : Integer; Char : String; CountAll : Integer; CountFirstArr : Integer; CopyLen : Integer; begin assign(FIn,'count.in'); reset(FIn); readLn(FIn,Line); close(FIn); LengthLn := Length(Line); StartLn := 1; CountFirstArr := 1; while CountFirstArr <= LengthLn do begin Arr[CountFirstArr]:=False; CountFirstArr := CountFirstArr + 1; end; CopyLen := 1; while StartLn<=LengthLn do begin Char := copy(Line,StartLn,CopyLen); if StrToInt(Char)=9 then CopyLen:= 2 else if StrToInt(Char)=99 then CopyLen:= 3 else if StrToInt(Char)=999 then CopyLen:= 4; Arr[StrToInt(Char)] := True; StartLn := StartLn+1; end; CountAll := 0; CountFirstArr :=1; while CountFirstArr <= LengthLn do begin if Arr[CountFirstArr]=True then CountAll:=CountAll+1; CountFirstArr := CountFirstArr + 1; end; Assign(FOut,'count.out'); Rewrite(FOut); WriteLn(FOut,CountAll); Close(FOut); end.