Cod sursa(job #898743)

Utilizator gcalceacalcea george gcalcea Data 28 februarie 2013 11:31:54
Problema Text Scor 40
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.75 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;
if pos('s-a',s)<>0 then
n:=n-1;

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(((ORD(S[i+1])>=65) and (ORD(S[i+1])<=90))
or ((ORD(S[i+1])>=97) and (ORD(S[i+1])<=122))) and (s[i]=' ') then
n:=n+1;


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