import re import sys re_digi = r'nyo[^a-z0-9]{0,3}$' re_petit = r'nyu[^a-z0-9]{0,3}$' re_rabi = r'[a-z0-9]' re_gema = r'gema[^a-z0-9]{0,3}$' re_piyo = r'pyo[^a-z0-9]{0,3}$' name_re = {'digi': re_digi, 'petit': re_petit, 'rabi': re_rabi, 'gema': re_gema, 'piyo': re_piyo} def check(text): if len(text) == 0: return False name = text.split(' ', -1)[0] text = text.lower() if name not in name_re: return False pat = name_re[name] serif = text[len(name):] #print(name, serif, pat) return re.search(pat, serif) def solve(): for l in sys.stdin: if check(l.rstrip('\n')): print('CORRECT (maybe)') else: print('WRONG!') if __name__ == '__main__': solve()