Mercurial > repo
view bin/rot13 @ 11135:eaec447b7046
<Jafet> mkx bin/\xe2\x81\x97//cc \'int i,r,n;main(){for(;n<1e5;n++,r*=2){for(i=2;i*i<=n;i++)if(n%i==0&&r--)break;r++;if((r&511)==325)printf("%d,%d,%d,%d%c",n-8,n-6,n-2,n,10);}}\'
author | HackBot |
---|---|
date | Thu, 27 Jul 2017 17:18:27 +0000 |
parents | 6412d84cf279 |
children |
line wrap: on
line source
#!/hackenv/bin/shebang_args_or_input python import re, sys, unicodedata as U def tr(c): m = re.match(r'(.*\bLATIN\b.*\bLETTER )([A-Z])\b(.*)', U.name(c, '')) if m: p, q, r = m.groups() n = ord(q) - ord('A') try: return U.lookup(p + chr(ord('A') + (n + 13) % 26) + r) except KeyError: return c return c def tr2(c): d = tr(c) if d != c: return d else: cs = [unichr(int(x, 16)) for x in U.decomposition(c).split()] ds = [tr(x) for x in cs] if cs != ds: return u''.join(ds) else: return c for c in unicode(sys.stdin.read(), 'utf8'): sys.stdout.write(tr2(c).encode('utf8'))