Buffy the Vampire Slayer LOVES larryk #### L = 2 (1 in slayer, one in larryk) O = 0 V = 1 (1 in vampire) E = 3 (1 each in the, vampire and slayer) S = 1 (1 in slayer) #### 2 0 1 3 1 2+0=2 0+1=1 1+3=4 3+1=4 2 1 4 4 2+1=3 1+4=5 4+4=8 3 5 8 3+5=8 5+8=13 (special case: if(>9) separate digits) 8 1 3 8+1=9 1+3=4 9 4 = 94% #### In this example the number of remaining chars is 20... F L A M E S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 remove the L F A M E S 1 2 3 4 now start at A .. 20 remove the F A M E S 1 2 3 4 now start at A .. 17 18 19 20 remove the S A M E 1 2 3 now start at A .. 19 20 remove the M A E 1 now start at E .. 20 remove the A E this is the key #### E = enemies #### #!perl -l $ARGV[0] = 'Buffy the Vampire Slayer'; $ARGV[1] = 'larryk'; @l = qw/l o v e s/; @f = qw/f l a m e s/; %t = ( f => 'friends', l => 'lovers', a => 'arguers', m => 'marriage material', e => 'enemies', s => 'secret lovers' ); sub g { my@F=@f;($s=join'',@_)=~s/\W//g;@_=map$s=~s/$_//gi,@l;$r=length $s;do{@_=map{split'',$_[$_]+$_[$_+1]}0..$#_-1}until 101>join'', @_;$n=0;splice@F,$n=($r+$n-1)%@F,1 while@F>1;join('',@_),@F } print +(g(@ARGV))[0],"% ",$t{(g(@ARGV))[1]}; __END__ 94% enemies