You are viewing a single comment's thread. Return to all comments →
My Solution:
import re for _ in range(int(input())): s = input() if re.match(r"^[456]([\d]{15}|[\d]{3}(-[\d]{4}){3})$", s) and not re.search(r"([\d])\1\1\1", s.replace("-", "")): print("Valid") else: print("Invalid")
Seems like cookies are disabled on this browser, please enable them to open this website
Validating Credit Card Numbers
You are viewing a single comment's thread. Return to all comments →
My Solution: