Цитата:
Сообщение от Student
наибольшее число, не входящее в строку от 0 до 9
|
Код:
Var
S:String;
A:Array [1..255] of Byte;
i,j,N:Byte;
Code:Integer;
Max:Byte;
b:boolean;
Begin
Writeln('Enter the string:');
Readln(S);
N:=0;
i:=0;
Repeat
repeat
Inc(i);
until ((Ord(S[i])>47) and (Ord(S[i])<58)) or (i>=Length(S));
If i<=Length(S) then
begin
Inc(N);
Val(S[i],A[N],Code);
end;
Until i>=Length(S);
Max:=A[1];
For i:=2 to N do
If A[i]>Max then Max:=A[i];
Repeat
b:=true;
Dec(Max);
for j:=1 to N do
if Max=A[j] then b:=false;
Until b or (Max=0);
If b then
Writeln('Result: ',Max)
else
Writeln('No such figure');
Readln;
End.