Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Code Written by : John Nixon
- #Date: 14:09:2022 Time: 22:39:59
- #Copyrights are applicable
- import sys
- import os
- sys.setrecursionlimit(10000)
- try:
- sys.stdin = open('./input.txt', 'r')
- sys.stdout = open('./output.txt', 'w')
- except:
- pass
- def distinct_years(sentence):
- different_years = set()
- str2 = ""
- for char in sentence:
- if char.isdigit():
- str2 += char
- if char == "-":
- str2 = ""
- if len(str2) == 4:
- different_years.add(str2)
- str2 = ""
- return len(different_years)
- string = input()
- print(distinct_years(string))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement