about summary refs log tree commit diff
path: root/12/TP-HN-2010/BAI2.PAS
blob: d6639df06203f84b33e40df2530ef67ca86cc7fb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var
  f : text;
  s : string;
  len, i, j : byte;
  count : integer = 0;

function libai2(s0 : string) : boolean;
  var
    bo, boo, b0 : boolean;
    c : char;
  begin
    b0 := false;
    bo := false;
    boo := false;
    for c in s0 do
      begin
        case c of
          '0' .. '9' : b0 := true;
          'a' .. 'z' : bo := true;
          'A' .. 'Z' : boo := true
        end;
        if b0 and bo and boo then exit(true)
      end;
    exit(false);
  end;

begin
  assign(f, 'BAI2.INP');
  reset(f);
  read(f, s);
  close(f);
  len := length(s);
  for i := 1 to len - 5 do
    for j := 6 to len - i + 1 do
      if libai2(copy(s, i, j)) then inc(count);
  assign(f, 'BAI2.OUT');
  rewrite(f);
  writeln(f, count);
  close(f)
end.