ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1654. Cipher Message

Test 6 Time limit exceeded Pascal
Posted by Denuha 26 Feb 2014 01:33
var
     text: string;
     flag: boolean;
     k, i: integer;

begin
     readln(text);
     flag := true;
     text := text + ' ';
     while flag do
     begin
          k := 1;
          for i := 1 to length(text) - 1 do
          begin
               if (text[i + 1] = ' ') then break;
               if (text[i] = text[i + 1]) then begin
                    delete(text, i, 2);
                    k := 0;
                    break;
               end;
          end;
          if k = 0 then flag := true else flag := false;
     end;
     for i := 1 to length(text) - 1 do write(text[i]);
end.

Edited by author 26.02.2014 01:33

Edited by author 26.02.2014 01:34