diff options
author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2020-06-06 21:33:13 +0700 |
---|---|---|
committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2020-06-06 21:33:13 +0700 |
commit | 2f674dc80f0382f1c3178f435714960734dc9d3c (patch) | |
tree | 2abba7e4ec72bd16f58f7375126144d3fd9f4bca /2ndary/12/TP-HN-2010/BAI2.PAS | |
parent | b2d80610db6beda38573890ed169815e495bc663 (diff) | |
download | cp-2f674dc80f0382f1c3178f435714960734dc9d3c.tar.gz |
Reorganize stuff from secondary school
Diffstat (limited to '2ndary/12/TP-HN-2010/BAI2.PAS')
-rw-r--r-- | 2ndary/12/TP-HN-2010/BAI2.PAS | 40 |
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. |