Cod sursa(job #898533)

Utilizator gcalceacalcea george gcalcea Data 28 februarie 2013 10:36:24
Problema Text Scor 30
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.64 kb
var s:string;
f,g:text;
k,i,n:integer;
begin
assign (f,'text.in');
reset(f);
assign(g,'text.out');
rewrite(g);
read(f,s);
k:=0;
n:=0;

s:=' '+s;

for i:=1 to length(s) do begin
if (ord(s[i]) >=65) and (ord(s[i]) <=90) then

k:=k+1;

if (ord(s[i]) >=97) and (ord(s[i]) <=122) then
k:=k+1;


if (ord(s[i])>=0) and(ord(s[i])<65) then
s[i]:=' ';

if (ord(s[i])>=91) and(ord(s[i])<97) then
s[i]:=' ';


if (ord(s[i])>=123) and(ord(s[i])<=127) then
s[i]:=' ';
end;

for i:=1 to length(s) do

if(s[i]=' ')and(s[i+1]>='A')and(s[i]<='z') then
n:=n+1;


writeln(s);
write(g,k div n);
close(f);
close(g);
readln;
end.