procedure TForm1.Button1Click(Sender: TObject);
var
f: TStringList;
i, j: integer;
diapazon, sp: string;
first, sfirst: integer;
second, ssecond: integer;
third, sthird: integer;
fourth, sfourth: integer;
begin
f:=TStringList.Create();
f.LoadFromFile('ipd.txt');
for I := 0 to f.Count - 1 do
begin
diapazon := f.Strings[i];
sp := copy(diapazon, pos(' ', diapazon)+1, Length(diapazon));
first := strtoint(copy(diapazon, 0, pos('.', diapazon)-1));
sfirst := strtoint(copy(sp, 0, pos('.', sp)-1));
Delete(diapazon, 1, pos('.', diapazon));
Delete(sp, 1, pos('.', sp));
second := strtoint(copy(diapazon, 0, pos('.', diapazon)-1));
ssecond := strtoint(copy(sp, 0, pos('.', sp)-1));
Delete(diapazon, 1, pos('.', diapazon));
Delete(sp, 1, pos('.', sp));
third := strtoint(copy(diapazon, 0, pos('.', diapazon)-1));
sthird := strtoint(copy(sp, 0, pos('.', sp)-1));
Delete(diapazon, 1, pos('.', diapazon));
Delete(sp, 1, pos('.', sp));
fourth := strtoint(copy(diapazon, 0, pos(' ', diapazon)-1));
sfourth := strtoint(copy(sp, 0, Length(sp)));
Delete(diapazon, 1, pos('.', diapazon));
Delete(sp, 1, pos('.', sp));
while j<>4 do
begin
Application.ProcessMessages;
if first<>sfirst then first:=first+1;
if second = ssecond then
if third = sthird then
if fourth = sfourth then
begin
second:=second+1;
fourth:=0;
third:=0;
second:=0;
end;
if second<>ssecond then;
if third = sthird then
if fourth = sfourth then
begin
second:=second+1;
fourth:=0;
third:=0;
end;
if third<>sthird then
if fourth = sfourth then
begin
third:=third+1;
fourth:=0;
end;
if fourth<>sfourth then fourth:=fourth+1;
Memo1.Lines.Add(inttostr(first)+'.'+inttostr(second)+'.'+inttostr(third)+'.'+inttostr(fourth));
if (first = sfirst) and (second = ssecond) and (third = sthird) and (fourth = sfourth) then j:=4;
end;
j:=0;
end;
f.Free;
end;