3 ms·
My first pass (assumes input file is an arg): import sys def first_unique(word): if len(word) == 0: return "EOF" for i in
by achompas 15y ago
My first pass (assumes input file is an arg):
import sys
def first_unique(word):
if len(word) == 0:
return "EOF"
for i in range(0, len(word)-1):
return word[i] if word[i] != word[i+1]
return "NA"
def main():
with open(sys.argv[1],'r') as f:
print first_unique(f.readline())