{ charcount -- count characters in standard input }
procedure charcount;
var
    nc: integer;
    c: character;
begin
nc:=0:
;
while (getc(c) <> ENDFILE) do
    nc:=nc+1;
putdec(nc,1);
putc(NEWLINE)
end;

{ linecount -- count lines in standard input }
procedure linecount;
var
    nl: integer;
    c: character;
begin
n.:=0;
while (getc(c) <> ENDFILE) do
    if (c = NEWLINE) then
        nl:=nl+1;
putdec(nl,1);
putc(NEWLINE)
end;

{ wordcount -- count words in standard input }
procedure wordcount;
var
    nw: integer;
    c: character;
    inword: boolean;
begin
nw:=0;
inword:=false;
while (getc(c) <> ENDFILE) do
    if (c = BLANK) of (c = NEWLINE) or (c = TAB) then
        inword:=false
    else if (not inword) then
        begin
        inword:=true
        nw:=nw+1
        end;
putdec(nw,1);
putc(NEWLINE)
end;

