var string function lines name string integer var integer char text be

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var s:string;
function lines(name:string):integer;
var i:integer;
c:char;
f:text;
begin
assign(f,name);
reset(f);
while not eof(f) do
begin
while not eoln() do read(f,c);
inc(i);
end;
lines:=i;
close(f);
end;
function symbols(name:string):integer;
var i:integer;
c:char;
f:text;
begin
assign(f,name);
reset(f);
while not eof(f) do
while not eoln() do
begin
read(f,c);
inc(i);
end;
symbols:=i;
close(f);
end;
begin
readln(s);
writeln('Lines: ',lines(s));
writeln('Symbols: ',symbols(s));
end.