fork download
  1. {$MODE OBJFPC}{$LONGSTRINGS ON}
  2.  
  3. procedure PrintDigits(AChar: PChar);
  4. var
  5. Digit: PChar;
  6. Count: Integer;
  7. begin
  8. while AChar^ <> #0 do
  9. begin
  10. Digit := AChar;
  11. Count := 0;
  12.  
  13. while AChar^ = Digit^ do
  14. begin
  15. Count += 1;
  16. AChar += 1;
  17. end;
  18.  
  19. WriteLn(Digit^, '[', Count, ']');
  20. end;
  21. end;
  22.  
  23. begin
  24. PrintDigits(PChar('0011101'));
  25. end.
  26.  
Success #stdin #stdout 0s 336KB
stdin
Standard input is empty
stdout
0[2]
1[3]
0[1]
1[1]