Commit | Line | Data |
---|---|---|
fde98a2d BJ |
1 | program countcharacters(input,output); |
2 | var ch: char; | |
3 | c0,c1,c2,c3,c4: integer; {counters} | |
4 | begin writeln(clock); { linelimit(output, -1); } | |
5 | c0 := 0; c1 := 0; c2 := 0; c3 := 0; c4 := 0; | |
6 | while not eof(input) do | |
7 | begin write(' '); c0 := c0+1; | |
8 | while not eoln(input) do | |
9 | begin read(ch); write(ch); | |
10 | if ch = ' ' then c1 := c1+1 else | |
11 | if ch in ['a'..'z'] then c2 := c2+1 else | |
12 | if ch in ['0'..'9'] then c3 := c3+1 else c4 := c4+1 | |
13 | end ; | |
14 | readln; writeln | |
15 | end ; | |
16 | writeln(clock); | |
17 | writeln(c0,' lines'); | |
18 | writeln(c1,' blanks'); | |
19 | writeln(c2,' letters'); | |
20 | writeln(c3,' digits'); | |
21 | writeln(c4,' special characters'); | |
22 | writeln(clock) | |
23 | end . |