#!/usr/bin/python
# -*- coding: UTF-8 -*-
# python 3.4
import re
import sys

def main(argv):

    rf = open(argv[0],'rU',encoding='UTF-8')
    outstring = ''
    try:
        outstring = rf.read()
    finally:
        rf.close()

    m = re.compile(r'#.*')
    outtmp = re.sub(m,'',outstring)
    outstring = outtmp

    outtmp = re.sub(r'^\n|\n+(?=\n)|\n$','',outstring)
    outstring = outtmp

    print(argv[0], argv[1])
    f = open(argv[1], 'w')
    f.write(outstring)
    f.close()

if __name__ == "__main__":
    main(sys.argv[1:])