about summary refs log tree commit diff
path: root/2ndary/12/TP-HN-2010/BAI2.PAS
diff options
context:
space:
mode:
Diffstat (limited to '2ndary/12/TP-HN-2010/BAI2.PAS')
-rw-r--r--2ndary/12/TP-HN-2010/BAI2.PAS40
1 files changed, 40 insertions, 0 deletions
diff --git a/2ndary/12/TP-HN-2010/BAI2.PAS b/2ndary/12/TP-HN-2010/BAI2.PAS
new file mode 100644
index 0000000..d6639df
--- /dev/null
+++ b/2ndary/12/TP-HN-2010/BAI2.PAS
@@ -0,0 +1,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.