#Python - <strike>114</strike> <strike>113</strike> <strike>153</strike> <strike>192</strike> <strike>174</strike> 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.