uses crt;
const fi='lop11a1.txt';
var f1:text;
st:array[1..255]of string;
n,i,dem,d,j,dem1,kq:integer;
a:shortstring;
b:array[1..1000]of integer;
begin
clrscr;
assign(f1,fi); rewrite(f1);
write('Nhap so ban trong Group:'); readln(n);
for i:=1 to n do
begin
write('Ban thu ',i,' ten:'); readln(st[i]);
end;
writeln(f1,'Danh sach cac ban trong Group la: ');
for i:=1 to n do
writeln(f1,'Ban thu ',i,' ten la: ',st[i]);
dem:=0;
for i:=1 to n do
begin
a:=st[i];
d:=length(a);
dem1:=0;
for j:=1 to d do
if a[j]=' ' then dem1:=dem1+1;
begin
inc(dem);
b[dem]:=dem1+1;
end;
end;
kq:=0;
for i:=1 to dem do
kq:=kq+b[i];
writeln(f1,'So tu trong day ten vua nhap la: ',kq);
close(f1);
readln;
end.