Cod sursa(job #1650936)

Utilizator SaniokMDACaliman Alexandru SaniokMDA Data 11 martie 2016 21:54:35
Problema Text Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.53 kb
var
  s: string;
  i, j, x, y, z: longint;

function eLitera(c: char): boolean;
begin
  eLitera := (c in ['a'..'z']) or (c in ['A'..'Z']);
end;

begin
  assign(input, 'text.in');
  assign(output, 'text.out');
  reset(input);
  rewrite(output);
  x := 0;
  y := 0;
  read(s);
  for i := 1 to length(s) do 
  begin
    if eLitera(s[i]) then x := x + 1;
    if i < length(s) then
      if not eLitera(s[i]) and eLitera(s[i+1]) then 
        y := y + 1;
  end;
  if eLitera(s[1]) then y := y + 1;
  write(x, ' ', y);
end.