Pagini recente » Cod sursa (job #2818057) | Cod sursa (job #1452182) | Cod sursa (job #864958) | Monitorul de evaluare | Cod sursa (job #2288274)
program Text;
uses sysutils;
var
NumarLitere, NumarCuvinte: integer;
c, lastchar: char;
fin: file of char;
fout: TextFile;
begin
assign(fin, 'text.in');
reset(fin);
while not eof(fin) do
begin
read(fin, c);
if ((ord(c) >= 65) and (ord(c) <= 90)) or ((ord(c) >= 97) and (ord(c) <= 122)) then
NumarLitere := NumarLitere + 1;
if (not(((ord(c) >= 65) and (ord(c) <= 90)) or ((ord(c) >= 97) and (ord(c) <= 122))) and (((ord(lastchar) >= 65) and (ord(lastchar) <= 90)) or ((ord(lastchar) >= 97) and (ord(lastchar) <= 122)))) then
NumarCuvinte := NumarCuvinte + 1;
lastchar := c;
end;
if (((ord(lastchar) >= 65) and (ord(lastchar) <= 90)) or ((ord(lastchar) >= 97) and (ord(lastchar) <= 122))) then
NumarCuvinte := NumarCuvinte + 1;
close(fin);
assign(fout, 'text.out');
rewrite(fout);
write(fout, NumarLitere div NumarCuvinte);
close(fout);
end.