Skip to main content
3 of 5
c appears in both exec and chr
bsoelch
  • 6.1k
  • 1
  • 11
  • 63

Python, 102 bytes, score 9 (ASCII only code)

See Unrelated String's solution for a lower score by using non-ascii characters


def f(s):print(end=f"exec({'+'.join('chr('+'+'.join(['1']*ord(c))+')'for c in f'print({repr(s)})')})") 

encodes string using exc()hr1+

Attempt This Online!

Explanation

Encodes string as exec(chr(1+...+1)+chr(1+1+...)+...)

The executed code is print(S) with S being the string-representation of the input. The characters in the string are represented as sums of 1's


Python, 89 bytes, score 11

def f(s):print(end=f"exec({'+'.join(f'chr(0b{ord(c):b})'for c in f'print({repr(s)})')})") 

Attempt This Online!

encodes string using exc()hr0b1+

bsoelch
  • 6.1k
  • 1
  • 11
  • 63