Advertisement
Guest User

Untitled

a guest
Oct 17th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.46 KB | None | 0 0
  1. function MakeDict(aList: TStringList): IIntArray;
  2. var
  3.     i: Integer;
  4.     str: string;
  5.     DoCount: INteger;
  6. begin
  7.     Result := CreateArray;
  8.     DoCount := 0;
  9.     for i := 0 to aList.Count - 1 do
  10.     begin
  11.         str := aList[i];
  12.         if str = 'do' then
  13.             Inc(DoCount);
  14.         if Result.Exist(str) then
  15.         begin
  16.             Result[str] := Result[str] + 1;
  17.         end
  18.         else
  19.         begin
  20.             Result[str] := 1;
  21.         end;
  22.     end;
  23.     if (DoCount > 0) then
  24.         Result['while'] := Result['while'] - DoCount;
  25. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement