Skip to main content
Commonmark migration
Source Link

#Python - 114 113 153 192 174 159 characters from sys import * s="";c=a=argv[1] for f in a: o=c.find;p=f.lower if '@'<f<'\': \td=o(f)-o(p()) \ts+=")"*d \tc=(c[:o(p())]+c[o(f)+1:]) else:s+=("("+f) print s

Python - 114 113 153 192 174 159 characters

from sys import *
s="";c=a=argv[1]
for f in a:
 o=c.find;p=f.lower
 if '@'<f<'\\':
\td=o(f)-o(p())
\ts+=")"*d
\tc=(c[:o(p())]+c[o(f)+1:])
 else:s+=("("+f)
print s

Abuses python's indentation parser to use one space for a full tab, five for two tabs.

Edit 1 - saved an unneeded space in the range() function

Edit 2 - fixed to deal with improper parse grammars, unterminated tags.

Edit 3 - fixed a bug whereby "incorrect" parses could be generated by ambiguity in the tag tree. Implemented a stack-based strategy, rather than a counter.

Edit 4 - renamed s.find to o to prevent save the chars used to repeatedly call it. did the same for f.lower.

Edit 5 - added the space/tab hack, saving three chars.

Edit 6 - ditched the loop in favor of ")"*d.

#Python - 114 113 153 192 174 159 characters from sys import * s="";c=a=argv[1] for f in a: o=c.find;p=f.lower if '@'<f<'\': \td=o(f)-o(p()) \ts+=")"*d \tc=(c[:o(p())]+c[o(f)+1:]) else:s+=("("+f) print s

Abuses python's indentation parser to use one space for a full tab, five for two tabs.

Edit 1 - saved an unneeded space in the range() function

Edit 2 - fixed to deal with improper parse grammars, unterminated tags.

Edit 3 - fixed a bug whereby "incorrect" parses could be generated by ambiguity in the tag tree. Implemented a stack-based strategy, rather than a counter.

Edit 4 - renamed s.find to o to prevent save the chars used to repeatedly call it. did the same for f.lower.

Edit 5 - added the space/tab hack, saving three chars.

Edit 6 - ditched the loop in favor of ")"*d.

Python - 114 113 153 192 174 159 characters

from sys import *
s="";c=a=argv[1]
for f in a:
 o=c.find;p=f.lower
 if '@'<f<'\\':
\td=o(f)-o(p())
\ts+=")"*d
\tc=(c[:o(p())]+c[o(f)+1:])
 else:s+=("("+f)
print s

Abuses python's indentation parser to use one space for a full tab, five for two tabs.

Edit 1 - saved an unneeded space in the range() function

Edit 2 - fixed to deal with improper parse grammars, unterminated tags.

Edit 3 - fixed a bug whereby "incorrect" parses could be generated by ambiguity in the tag tree. Implemented a stack-based strategy, rather than a counter.

Edit 4 - renamed s.find to o to prevent save the chars used to repeatedly call it. did the same for f.lower.

Edit 5 - added the space/tab hack, saving three chars.

Edit 6 - ditched the loop in favor of ")"*d.

edited body
Source Link
arrdem
  • 846
  • 5
  • 15

#Python - 114 113 153 192 184174 174159 characters from sys import * s="";c=a=argv[1] for f in a: o=c.find;p=f.lower if '@'<f<'\': \td=o(f)-o(p()) \ts+=")"*d \tc=(c[:o(p())]+c[o(f)+1:]) else:s+=("("+f) print s

Abuses python's indentation parser to use one space for a full tab, five for two tabs.

Edit 1 - saved an unneeded space in the range() function

Edit 2 - fixed to deal with improper parse grammars, unterminated tags.

Edit 3 - fixed a bug whereby "incorrect" parses could be generated by ambiguity in the tag tree. Implemented a stack-based strategy, rather than a counter.

Edit 4 - renamed s.find to o to prevent save the chars used to repeatedly call it. did the same for f.lower.

Edit 5 - added the space/tab hack, saving three chars.

Edit 6 - ditched the loop in favor of ")"*d.

#Python - 114 113 153 192 184 174 characters from sys import * s="";c=a=argv[1] for f in a: o=c.find;p=f.lower if '@'<f<'\': \td=o(f)-o(p()) \ts+=")"*d \tc=(c[:o(p())]+c[o(f)+1:]) else:s+=("("+f) print s

Abuses python's indentation parser to use one space for a full tab, five for two tabs.

Edit 1 - saved an unneeded space in the range() function

Edit 2 - fixed to deal with improper parse grammars, unterminated tags.

Edit 3 - fixed a bug whereby "incorrect" parses could be generated by ambiguity in the tag tree. Implemented a stack-based strategy, rather than a counter.

Edit 4 - renamed s.find to o to prevent save the chars used to repeatedly call it. did the same for f.lower.

Edit 5 - added the space/tab hack, saving three chars.

Edit 6 - ditched the loop in favor of ")"*d.

#Python - 114 113 153 192 174 159 characters from sys import * s="";c=a=argv[1] for f in a: o=c.find;p=f.lower if '@'<f<'\': \td=o(f)-o(p()) \ts+=")"*d \tc=(c[:o(p())]+c[o(f)+1:]) else:s+=("("+f) print s

Abuses python's indentation parser to use one space for a full tab, five for two tabs.

Edit 1 - saved an unneeded space in the range() function

Edit 2 - fixed to deal with improper parse grammars, unterminated tags.

Edit 3 - fixed a bug whereby "incorrect" parses could be generated by ambiguity in the tag tree. Implemented a stack-based strategy, rather than a counter.

Edit 4 - renamed s.find to o to prevent save the chars used to repeatedly call it. did the same for f.lower.

Edit 5 - added the space/tab hack, saving three chars.

Edit 6 - ditched the loop in favor of ")"*d.

added 58 characters in body
Source Link
arrdem
  • 846
  • 5
  • 15

#Python - 114 113 153 192 184 characters184 174 characters from sys import * s="";c=a=argv[1] for f in a: o=c.find;p=f.lower if '@'<f<'\': \td=o(f)-o(p()) \tfor i in range(d):s+="\ts+=")""*d \tc=(c[:o(p())]+c[o(f)+1:]) else:s+=("("+f) print s

Abuses python's indentation parser to use one space for a full tab, five for two tabs.

Edit 1 - saved an unneeded space in the range() function

Edit 2 - fixed to deal with improper parse grammars, unterminated tags.

Edit 3 - fixed a bug whereby "incorrect" parses could be generated by ambiguity in the tag tree. Implemented a stack-based strategy, rather than a counter.

Edit 4 - renamed s.find to o to prevent save the chars used to repeatedly call it. did the same for f.lower.

Edit 5 - added the space/tab hack, saving three chars.

Edit 6 - ditched the loop in favor of ")"*d.

#Python - 114 113 153 192 184 characters from sys import * s="";c=a=argv[1] for f in a: o=c.find;p=f.lower if '@'<f<'\': \td=o(f)-o(p()) \tfor i in range(d):s+=")" \tc=(c[:o(p())]+c[o(f)+1:]) else:s+=("("+f) print s

Abuses python's indentation parser to use one space for a full tab, five for two tabs.

Edit 1 - saved an unneeded space in the range() function

Edit 2 - fixed to deal with improper parse grammars, unterminated tags.

Edit 3 - fixed a bug whereby "incorrect" parses could be generated by ambiguity in the tag tree. Implemented a stack-based strategy, rather than a counter.

Edit 4 - renamed s.find to o to prevent save the chars used to repeatedly call it. did the same for f.lower.

Edit 5 - added the space/tab hack, saving three chars.

#Python - 114 113 153 192 184 174 characters from sys import * s="";c=a=argv[1] for f in a: o=c.find;p=f.lower if '@'<f<'\': \td=o(f)-o(p()) \ts+=")"*d \tc=(c[:o(p())]+c[o(f)+1:]) else:s+=("("+f) print s

Abuses python's indentation parser to use one space for a full tab, five for two tabs.

Edit 1 - saved an unneeded space in the range() function

Edit 2 - fixed to deal with improper parse grammars, unterminated tags.

Edit 3 - fixed a bug whereby "incorrect" parses could be generated by ambiguity in the tag tree. Implemented a stack-based strategy, rather than a counter.

Edit 4 - renamed s.find to o to prevent save the chars used to repeatedly call it. did the same for f.lower.

Edit 5 - added the space/tab hack, saving three chars.

Edit 6 - ditched the loop in favor of ")"*d.

added 138 characters in body; added 60 characters in body
Source Link
arrdem
  • 846
  • 5
  • 15
Loading
added 215 characters in body
Source Link
arrdem
  • 846
  • 5
  • 15
Loading
added 153 characters in body
Source Link
arrdem
  • 846
  • 5
  • 15
Loading
Source Link
arrdem
  • 846
  • 5
  • 15
Loading