Skip to content

Instantly share code, notes, and snippets.

@AvocadosConstant
Last active June 26, 2017 14:14
Show Gist options
  • Save AvocadosConstant/eff3525643d012859cdd81411ce9efea to your computer and use it in GitHub Desktop.
Save AvocadosConstant/eff3525643d012859cdd81411ce9efea to your computer and use it in GitHub Desktop.
import sys
"""
Solution to http://100.70.19.162:8000/contest/32/11
"""
def check_friendly(s, l):
if (len(s) == len(l) and sum(s[i] != l[i] for i in range(len(s))) <= 1
or len(s) == len(l) - 1 and s == l[:-1]
or len(s) == len(l) + 1 and s[:-1] == l):
return 'TRUE'
return('FALSE')
data = sys.stdin.read().splitlines()
print(check_friendly(data[0], data[1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment