Skip to content

Instantly share code, notes, and snippets.

@popey456963
Created October 24, 2015 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save popey456963/b75f673f64b4edf87c18 to your computer and use it in GitHub Desktop.
Save popey456963/b75f673f64b4edf87c18 to your computer and use it in GitHub Desktop.
Minifying CDX
n = int(input())
a = []
for i in range(n):
a.append(input())
b = "".join(a)
c = b.split("'")
data = ""
for key,val in enumerate(c):
if key % 2 == 0:
data+="".join(val.split())
else:
data+="'" + val + "'"
print(data)
@developius
Copy link

n = int(raw_input())
l=[]
for i in xrange(n):
    cgx_content = raw_input()
    l.append(cgx_content.rstrip())
b=""
for char in l:
    if "'" not in char:
        b+=char.replace(" ","")
    else:b+=char.strip()
q=False
b2=""
for char in b:
    if "'" in char:
        if q:q=False
        else:q=True
    if not q:
        b2+=char.replace(" ","")
    else:b2+=char
print(b2)

Oh well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment