from sys import stdin, stdout def main(inp, inps, put): ANSWER = [20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841] S = inp().rstrip().replace(".", "") counts = [0]*10 for s in S: counts[int(s)] += 1 enough, not_enough = 0, 0 for i, c in enumerate(counts): if(ANSWER[i] > c): not_enough = i elif(ANSWER[i] < c): enough = i print(enough, not_enough) main(stdin.readline, stdin.readlines, stdout.write)