fork(2) download
  1. LABEL prev,next;
  2. var
  3. data_mem: array[1..10] of integer;
  4. command_mem: string;
  5. i,j,k: integer;
  6. begin
  7. j:=1;
  8. i:=1;
  9. readln(command_mem);
  10. prev:
  11. if i>length(command_mem) then goto next;
  12. if (command_mem[i]='+') then data_mem[j]:= data_mem[j]+1;
  13. if (command_mem[i]='-') then data_mem[j]:= data_mem[j]-1;
  14. if (command_mem[i]='>') then j:=j+1;
  15. if (command_mem[i]='<') then j:=j-1;
  16. if (command_mem[i]='.') then write(chr(data_mem[j]));
  17.  
  18. i:=i+1;
  19. goto prev;
  20. next:
  21. for k:=1 to 10 do begin
  22. write(data_mem[k]);
  23. write(' ');
  24. end;
  25. end.
Success #stdin #stdout 0s 9128KB
stdin
+>++>+++
stdout
1 2 3 0 0 0 0 0 0 0