Skip to content

Instantly share code, notes, and snippets.

@NeedPainkiller
Created March 15, 2018 08:14
Show Gist options
  • Select an option

  • Save NeedPainkiller/75a5bd2ed4c3506b73805aec3133a4a8 to your computer and use it in GitHub Desktop.

Select an option

Save NeedPainkiller/75a5bd2ed4c3506b73805aec3133a4a8 to your computer and use it in GitHub Desktop.
def checkTrait(c):
return (int((ord(c) - 0xAC00) % 28) != 0)
def openInput():
inputs = open('./input.txt', 'r', encoding='UTF8')
res = ''
for line in inputs:
for index, s in enumerate(line):
if(s == "을" and checkTrait(line[index-1]) == False):
line = line[:index] + '를' + line[index+1:]
if(s == "를" and checkTrait(line[index-1]) == True):
line = line[:index] + '을' + line[index+1:]
res += line
inputs.close()
outputs = open('./output.txt', 'w', encoding='UTF8')
outputs.write(res)
outputs.close()
openInput()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment