CSES - Datatähti 2024 alku - Results
Submission details
Task:Monistus
Sender:Miika
Submission time:2023-10-30 09:04:40 +0200
Language:Pascal
Status:COMPILE ERROR

Code

program ohjelma;
uses
SysUtils, RegExpr;
var
i: string;
tempstr: string;
z: Integer;
match: TRegExpr;
f: Integer;
item: Integer;
begin
ReadLn(i);
tempstr := '.';
while tempstr <> '' do
begin
z := 0;
tempstr := '';
match := TRegExpr.Create;
match.Expression := '\d';
if match.Exec(i) then
begin
z := StrToInt(match.Match[0]);
f := match.MatchPos[0];
Delete(i, f, 1);
for item := 1 to z do
begin
tempstr := tempstr + i[item + f - 1];
z := z - 1;
end;
Insert(tempstr, i, f);
end;
match.Free;
end;
WriteLn(i);
end.