|
|
Initial revision
415145824
program countcharacters(input,output);
var ch: char;
c0,c1,c2,c3,c4: integer; {counters}
begin writeln(wallclock); { linelimit(output, -1); }
c0 := 0; c1 := 0; c2 := 0; c3 := 0; c4 := 0;
while not eof(input) do
begin write(' '); c0 := c0+1;
while not eoln(input) do
begin read(ch); write(ch);
if ch = ' ' then c1 := c1+1 else
if ch in ['a'..'z'] then c2 := c2+1 else
if ch in ['0'..'9'] then c3 := c3+1 else c4 := c4+1
end ;
readln; writeln
end ;
writeln(wallclock);
writeln(c0,' lines');
writeln(c1,' blanks');
writeln(c2,' letters');
writeln(c3,' digits');
writeln(c4,' special characters');
writeln(wallclock)
end .
415145825
23 lines
138 blanks
355 letters
38 digits
128 special characters
415145825
4134 statements executed in 0.62 seconds cpu time.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.