Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (X), (X), bo-b(Y)
- Banana-fana fo-f(Y)
- Fee-fi-mo-m(Y)
- (X)!
- Shirley, Shirley, bo-birley
- Banana-fana fo-firley
- Fee-fi-mo-mirley
- Shirley!
- Arnold, Arnold, bo-barnold
- Banana-fana fo-farnold
- Fee-fi-mo-marnold
- Arnold!
- Bob, Bob, bo-ob
- Banana-fana fo-fob
- Fee-fi-mo-mob
- Bob!
- Fred, Fred, bo-bed
- Banana-fana fo-red
- Fee-fi-mo-med
- Fred!
- Y2PA,<ESC>Ypj~Y2PIbo-b<c-o>wBanana-fana fo-f<c-o>wFee-fi-mo-m<c-o>2$!<ESC>HJJ:%s/vo-(([bfm])2([^aeiou]*))?([bfm]?)[^aeiou]*/o-34
- ZZ
- N = TRIM(INPUT)
- D = REPLACE(N,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- +'abcdefghijklmnopqrstuvwxyz')
- B = "b" D
- F = "f" D
- M = "m" D
- &ANCHOR = 1
- D SPAN('bcdfghjklmnpqrstvwxyz') . I REM . R :F(Y)
- B = "b" R
- F = "f" R
- M = "m" R
- I "b" :S(U)
- I "f" :S(V)
- I "m" :S(W) F(Y)
- U D "b" REM . B :(Y)
- V D "f" REM . F :(Y)
- W D "m" REM . M
- Y OUTPUT = N ", " N ", bo-" B
- OUTPUT = "Banana-fana fo-" F
- OUTPUT = "Fee-fi-mo-" M
- OUTPUT = N "!"
- END
- OUTPUT = "Please enter your name."
- Name = TRIM(INPUT)
- UC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
- LC = 'abcdefghijklmnopqrstuvwxyz'
- Low = REPLACE(Name, UC, LC)
- BName = "b" Low
- FName = "f" Low
- MName = "m" Low
- Consonants = SPAN('bcdfghjklmnpqrstvwxyz')
- &ANCHOR = 1
- Low Consonants . First REM . Rest :F(READY)
- BName = "b" Rest
- FName = "f" Rest
- MName = "m" Rest
- First "b" :S(BINIT)
- First "f" :S(FINIT)
- First "m" :S(MINIT) F(READY)
- BINIT Low "b" REM . BName :(READY)
- FINIT Low "f" REM . FName :(READY)
- MINIT Low "m" REM . MName
- READY OUTPUT = Name ", " Name ", bo-" BName
- OUTPUT = "Banana-fana fo-" FName
- OUTPUT = "Fee-fi-mo-" MName
- OUTPUT = Name "!"
- END
- :(TARGET)
- :S(SUCCESS) F(FAILURE)
- # $RUN *SNOBOL4 5=GOLF.SNO+*SOURCE* 6=*DUMMY*(1,28)+*SINK*(1,4)+*DUMMY*
- # Execution begins 16:57:25
- Snowman
- Snowman, Snowman, bo-bowman
- Banana-fana fo-fowman
- Fee-fi-mo-mowman
- Snowman!
- # Execution terminated 16:57:30 T=0.013
- 1!:2&2>|.(n,'!');('Fee-fi-mo-';'Banana-fana fo-';n,', ',n,', bo-'),&.>;/'mfb'(,`(}.@])`($:}.)@.((=+.2*5='aeiou'i.]){.)"0 _)a.{~32(23 b.)a.i.n=.1!:1]3
- r=x=>x.match(/[aeiou]w*/i)[0];f=x=>`${x}, ${x}, bo-b${r(x)}nBanana-fana fo-f${r(x)}nFee-fi-mo-m${r(x)}n${x}!`
- r=x=>x.match(/[aeiouAEIOU]w*/)[0]
- f=x=>`${x}, ${x}, bo-b${r(x)}nBanana-fana fo-f${r(x)}nFee-fi-mo-m${r(x)}n${x}!`
- (defn name-game
- [n]
- (let [[b f m] (map (fn [x] (if (some #(= % (first n) (last x)) "bfm")
- (str (apply str (butlast x)) (apply str (rest n)))
- (str x (apply str (drop-while (fn [x] (not (some #(= % x) "aeiou"))) n))))) [", bo-b" "nBanana-fana-fo-f" "nFee-fi-mo-m"])]
- (str n ", " n b f m "n" n "!")))
- val v="""#, #, bo-b0
- Banana-fana fo-f1
- Fee-fi-mo-m2
- #!"""
- type S=String
- def a(b:S,c:S,d:S)=b.replaceAll(c,d)
- def r(t:S,n:S,i:Int)=if(n(0)=="bfm"(i).toUpper)a(t,"."+i,n.tail)else
- a(t,""+i,a(n,"^[^AEIOUaeiou]*([aeiou].*)","$1")).toLowerCase
- def x(n:S)=a(r(r(r(v,n,0),n,1),n,2),"#",n)
- val l = List ("Shirley", "Arnold", "Bob", "Fred")
- for (n <- l) println (x (n) + "n")
- val templ = """#, #, bo-b0
- Banana-fana fo-f1
- Fee-fi-mo-m2
- #!"""
- val names = List ("Shirley", "Arnold", "Bob", "Fred")
- val keys = "bfm"
- def recode (template: String, n: String, i: Int) =
- if (n(0) == keys(i).toUpper)
- template.replaceFirst ("." + i, n.tail) else
- template.replaceAll ("" + i, (n.replaceAll ("^[^AEIOUYaeiouy]*([aeiou].*)", "$1").toLowerCase))
- for (name <- names)
- println (recode (recode (recode (templ, name, 0), name, 1), name, 2).replaceAll ("#", name) + "n")
- n=input();i=0
- r=n[i:].lower()
- while n[i]not in'aeiouAEIOU':i+=1;r=n[i:]
- print(f'{n}, {n}, bo-b{r}nBanana-fana fo-f{r}nFee-fi-mo-m{r}n{n}!')
- def f(n,i=0):
- r=n[i:].lower()
- while n[i].lower()not in'aeiou':i+=1;r=n[i:]
- return f'{n}, {n}, bo-b{r}nBanana-fana fo-f{r}nFee-fi-mo-m{r}n{n}!'
- sed 'h;G;G;G' |sed '1s/.*/&, &, bo-bL&/i;2s/^.*/Banana-fana fo-fL&/;3s/^.*/Fee-fi-mo-mL&/;4s/$/!/;tx;:x;s/o-([bfm])1/o-/i;tz;s/(o-[bfm])[^aeiou]+/1/;:z'
- sed 'h ;# copy to hold buffer
- G ;# append newline + hold buffer to pattern
- G ;# ditto for next two G's
- G' |sed '1s/.*/&, &, bo-bL&/i ;# 1st line -> X, X bo-bx (lowercase)
- 2s/^.*/Banana-fana fo-fL&/ ;# 2nd line -> Banana-fana fo-fx
- 3s/^.*/Fee-fi-mo-mL&/ ;# 3rd line -> Fee-fi-mo-mx
- 4s/$/!/ ;# bang the 4th line!
- tx ;# jump to :x if any s/// has matched
- :x ;# spoiler alert: it has! reset t-flag
- s/o-([bfm])1/o-/i ;# match some o-cc where c = [bfm]
- tz ;# if that matched, branch to :z
- s/(o-[bfm])[^aeiou]+/1/ ;# replace o-[bfm] plus consonants with o-[bfm]
- :z ;# target of tz, skips over previous s///'
- x=raw_input('')
- a,b,c=x[0],x[1:],'bfm'
- if b[0] in c:b=b[1:]
- d="X, X, bo-@nBanana-fana fo-@nFee-fi-mo-@nX!".replace('X',a)
- for y in c:d=d.replace('@',y+b,1)
- print d
- r={n->m={n[0]==it[0]?n[1..-1]:it[1]+(n.toLowerCase()=~'[aeiou].*')[0]};"$n, $n, bo-${m 'Bb'}nBanana-fana fo-${m 'Ff'}nFee-fi-mo-${m 'Mm'}n$n!"}
- assert ['Shirley', 'Arnold', 'Bob', 'Fred'].collect { r(it) } == [
- '''Shirley, Shirley, bo-birley
- Banana-fana fo-firley
- Fee-fi-mo-mirley
- Shirley!''',
- '''Arnold, Arnold, bo-barnold
- Banana-fana fo-farnold
- Fee-fi-mo-marnold
- Arnold!''',
- '''Bob, Bob, bo-ob
- Banana-fana fo-fob
- Fee-fi-mo-mob
- Bob!''',
- '''Fred, Fred, bo-bed
- Banana-fana fo-red
- Fee-fi-mo-med
- Fred!'''
- ]
- x=scan(,'');f=function(b)if(grepl(b,x))sub('.','',x)else tolower(sub('^[^aoueiy]*',b,x,i=T));cat(sprintf('%s, %1$s, bo-%snBanana-fana fo-%snFee-fi-mo-%sn%1$s!n',x,f('B'),f('F'),f('M')))
- x=scan(,'');f=function(b)ifelse(grepl(b,x),sub('.','',x),tolower(sub('^[^aoueiy]*',b,x,i=T)));cat(sprintf('%s, %1$s, bo-%snBanana-fana fo-%snFee-fi-mo-%sn%1$s!n',x,f('B'),f('F'),f('M')))
- V"BFM"IqhzN=aYtrz0.?=aY+rN0:rz0"^[^aeiou]+"k))+%." sÞXY:lÍ"*]z2@Y0+." o1}1ÃЬÛJî½"@Y1+."-o Âkq°ë¹è"@Y2+z!
- n=raw_input('')
- if n[0].lower() in ("m", "f", "b"): r=n[1:]
- else:
- i = iter(n.lower())
- for a in range(len(n)):
- if i.next() in ("a","e","i","o","u"):
- r = n[a:]
- break
- print "%s, %s, bo-b%snBanana-fana fo-f%snFee-fi-mo-m%sn%s!" %(name,name,rhyme,rhyme,rhyme,name)
Add Comment
Please, Sign In to add comment