uses crt;
type kmang=array[0..255] of integer;
var fi,fo:text;
st:string;
kq:kmang;
k,i:integer;
procedure khoitao;
begin
assign(fi,'PASSWORD.INP');
assign(fo,'PASSWORD.OUT');
{$I-} reset(fi); {$I+}
if ioresult<>0 then
begin
rewrite(fi);
reset(fi);
end;
read(fi,st); k:=0;
fillchar(kq,sizeof(kq),0);
close(fi); rewrite(fo);
end;
function snt(x:integer):boolean;
var tam:integer;
begin
snt:=true;
if x<2 then snt:=false
else
for tam:=2 to round(sqrt(x)) do
if x mod tam = 0 then exit(false);
end;
procedure tachso(xau:string; var kq:kmang; var k:integer);
var t1,t3,t4:integer;
t2:string;
begin
t1:=1;
while t1<=length(xau) do
begin
t2:=copy(xau,t1,4);
val(t2,t3); t4:=4;
while (snt(t3)=false) and (t3>0) do
begin
dec(t4);
t3:=t3 div 10;
end;
if t3>0 then
begin
inc(k);
kq[k]:=t3;
t1:=t1+t4;
end
else inc(t1);
end;
end;
procedure xuly;
var j,max:integer;
s1:string;
begin
i:=1;
while i<=length(st) do
begin
if st[i] in ['0'..'9'] then
begin
j:=i;
repeat
inc(j);
until
not(st[j] in ['0'..'9']);
s1:=copy(st,i,j-i);
tachso(s1,kq,k);
i:=j+1;
end
else inc(i);
end;
max:=kq[1];
for i:=2 to k do
if kq[i]>max then max:=kq[i];
write(fo,max);
end;
BEGIN
khoitao; xuly;
close(fo);
END.
Làm hơi bị lâu đó, cho mình câu trả lời hay nhất nha.