Skip to main content
Post Undeleted by Dom Hastings
added 102 characters in body
Source Link
Dom Hastings
  • 24.4k
  • 4
  • 56
  • 93

Perl 5 with -pl, 4143 bytes

Uses newline separated input and prints -1 for characters not appearing in the program.

$_=q{print index"\$_=q$s=q{$_};eval"$_=index"\$s=q{$s};eval\$s",<>$_};eval;eval$s

Try it online!Try it online!

Perl 5, 41 bytes

$_=q{print index"\$_=q{$_};eval",<>};eval

Try it online!

Perl 5 with -pl, 43 bytes

Uses newline separated input and prints -1 for characters not appearing in the program.

$s=q{$_=index"\$s=q{$s};eval\$s",$_};eval$s

Try it online!

Post Deleted by Dom Hastings
Source Link
Dom Hastings
  • 24.4k
  • 4
  • 56
  • 93

Perl 5, 41 bytes

$_=q{print index"\$_=q{$_};eval",<>};eval

Try it online!