examples = '''Spenglerium, Ee
Zeddemorium, Zr
Venkmine, Kn
Stantzon, Zt
Melintzum, Nn
Tullium, Ty'''
def main():
for line in examples.splitlines():
test_case = line.split(', ')
print(validate_symbol(test_case[0], test_case[1]))
def validate_symbol(element, symbol):
result = False
char_1 = [i for i, v in enumerate(element) if v.lower() == symbol[0].lower()]
char_2 = [i for i, v in enumerate(element) if v.lower() == symbol[1].lower()]
if char_1 and char_2:
for x in char_1:
for y in char_2:
if x < y: result = True
return result
if __name__ == '__main__': main()
ZXhhbXBsZXMgPSAnJydTcGVuZ2xlcml1bSwgRWUKWmVkZGVtb3JpdW0sIFpyClZlbmttaW5lLCBLbgpTdGFudHpvbiwgWnQKTWVsaW50enVtLCBObgpUdWxsaXVtLCBUeScnJwoKZGVmIG1haW4oKToKICAgIGZvciBsaW5lIGluIGV4YW1wbGVzLnNwbGl0bGluZXMoKToKICAgICAgICB0ZXN0X2Nhc2UgPSBsaW5lLnNwbGl0KCcsICcpCiAgICAgICAgcHJpbnQodmFsaWRhdGVfc3ltYm9sKHRlc3RfY2FzZVswXSwgdGVzdF9jYXNlWzFdKSkKCmRlZiB2YWxpZGF0ZV9zeW1ib2woZWxlbWVudCwgc3ltYm9sKToKICAgIHJlc3VsdCA9IEZhbHNlCgogICAgY2hhcl8xID0gW2kgZm9yIGksIHYgaW4gZW51bWVyYXRlKGVsZW1lbnQpIGlmIHYubG93ZXIoKSA9PSBzeW1ib2xbMF0ubG93ZXIoKV0KICAgIGNoYXJfMiA9IFtpIGZvciBpLCB2IGluIGVudW1lcmF0ZShlbGVtZW50KSBpZiB2Lmxvd2VyKCkgPT0gc3ltYm9sWzFdLmxvd2VyKCldCgogICAgaWYgY2hhcl8xIGFuZCBjaGFyXzI6CiAgICAgICAgZm9yIHggaW4gY2hhcl8xOiAgICAgICAgICAgIAogICAgICAgICAgICBmb3IgeSBpbiBjaGFyXzI6CiAgICAgICAgICAgICAgICBpZiB4IDwgeTogcmVzdWx0ID0gVHJ1ZQoKICAgIHJldHVybiByZXN1bHQKCmlmIF9fbmFtZV9fID09ICdfX21haW5fXyc6IG1haW4oKQ==