9-hole mini-golf: Text Manipulation

Score: 382 * 1.12 = 462

Languages prone to change.

1. APL, 8 4

Thanks @marinus for shaving 4 chars off.

f←⍴~

Called with the strings as the left and right arguments, eg.

      'foobarbaz' f 'ao'
5

2. Ruby, 35 31

Thanks @DoorknobofSnow for shaving 4 chars off.

f=->s,r{s.gsub(/(?<=^)/,r+' ')}

3. Python, 48

f=lambda s,n,b:s.replace(*['\t',' '*n][::2*b-1])

4. GolfScript, 20

{@//zip{' '*}%n*}:f;

Assumes that the arguments are on the stack. Test online

5. J, 50

f=:({~[:(i.>./)+/"1@=@(}.~0-1{$))@|:@([$~],1+[:$[)

Called with the string as the left argument and the number as the right, eg.

   'abcdeabcfghiabc' f 3
abc

6. Ruby, 61

f=->s{s.gsub(/(?<!^| )[^ ]+(?!$| )/){[*$&.chars].shuffle*''}}

7. GolfScript, 39 35 34

{[.10,' '*-{{}/]' '*}{~]''+}if}:f;

Again, assumes the argument is on the stack. Test online

8. Perl, 98

sub f{$_=@_[0];s!\*\*(.+?)\*\*!<b>$1</b>!g;s!\*(.+?)\*!<i>$1</i>!g;s!`(.+?)`!<code>$1</code>!g;$_}

9. Haskell, 36

f s n r=[(x++cycle r)!!n|x<-words s]

Python - 697 × 1.19 ≈ 1644

Gee, I sure love lambdas.

Note: 3 and 5 were shamelessly copied from Volatility's answer, as I couldn't find a better alternative. Also, this was done just for fun.

f=lambda a,b:sum([x not in b for x in a])        # 1, 41 chars
f=lambda a,b:b+' '+a.replace('\n','\n'+b+' ')    # 2, 43 chars
f=lambda s,n,b:s.replace(*['\t',' '*n][::b*2-1]) # 3, 47 chars
f=lambda s,n,m:'\n'.join([' '.join([s[x:x+m]for x in range(y*m,len(s),m*n)])for y in range(n)])
                                                 # 4, 94 chars
f=lambda s,n:max([s[x:x+n]for x in range(len(s)+1-n)],key=s.count)
                                                 # 5, 66 chars
import random;f=lambda s:' '.join([''.join(sorted(y,key=lambda*x:random.random()))for y in s.split()])
                                                 # 6, 102 chars
f=lambda s:s.replace(' ','').isdigit()and ''.join(map(chr,map(int,s.split())))or ' '.join(map(str,map(ord,s)))
                                                 # 7, 110 chars
import re;f=lambda s:re.sub('`(.*?)`','<code>\\1</code>',re.sub(r'\*(.*?)\*','<i>\\1</i>',re.sub(r'\*\*(.*?)\*\*','<b>\\1</b>',s)))
                                                 # 8, 128 chars
f=lambda s,n,r:''.join([len(x)>n and x[n]or r for x in s.split()])
                                                 # 9, 66 chars

EDIT: Thanks to Volatility for the tips.