blob: ede75dbe5a22e68b8be0f965820532446d65321a (
plain)
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
|
#!/usr/bin/env python3
import sys
def main(argv):
#print(argv[2], file=sys.stderr)
allowed_times = int(argv[2]) if len(argv) > 2 else 1
#print(allowed_times, file=sys.stderr)
while 1:
letters_counts = {}
line = sys.stdin.readline()
noprint = False
if not line:
break;
for c in line:
#print(c)
c = c.casefold()
letters_counts[c] = letters_counts.get(c, 0) + 1
if letters_counts[c] > allowed_times and c in argv[1]:
#print('oops')
noprint = True
break
if line and not noprint:
print(line, end='')
if __name__ == '__main__':
main(sys.argv)
|