#!/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)