Guest User

Untitled

a guest
Apr 26th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.32 KB | None | 0 0
  1. (X), (X), bo-b(Y)
  2. Banana-fana fo-f(Y)
  3. Fee-fi-mo-m(Y)
  4. (X)!
  5.  
  6. Shirley, Shirley, bo-birley
  7. Banana-fana fo-firley
  8. Fee-fi-mo-mirley
  9. Shirley!
  10.  
  11. Arnold, Arnold, bo-barnold
  12. Banana-fana fo-farnold
  13. Fee-fi-mo-marnold
  14. Arnold!
  15.  
  16. Bob, Bob, bo-ob
  17. Banana-fana fo-fob
  18. Fee-fi-mo-mob
  19. Bob!
  20.  
  21. Fred, Fred, bo-bed
  22. Banana-fana fo-red
  23. Fee-fi-mo-med
  24. Fred!
  25.  
  26. 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
  27. ZZ
  28.  
  29. N = TRIM(INPUT)
  30. D = REPLACE(N,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
  31. +'abcdefghijklmnopqrstuvwxyz')
  32. B = "b" D
  33. F = "f" D
  34. M = "m" D
  35. &ANCHOR = 1
  36. D SPAN('bcdfghjklmnpqrstvwxyz') . I REM . R :F(Y)
  37. B = "b" R
  38. F = "f" R
  39. M = "m" R
  40. I "b" :S(U)
  41. I "f" :S(V)
  42. I "m" :S(W) F(Y)
  43. U D "b" REM . B :(Y)
  44. V D "f" REM . F :(Y)
  45. W D "m" REM . M
  46. Y OUTPUT = N ", " N ", bo-" B
  47. OUTPUT = "Banana-fana fo-" F
  48. OUTPUT = "Fee-fi-mo-" M
  49. OUTPUT = N "!"
  50. END
  51.  
  52. OUTPUT = "Please enter your name."
  53. Name = TRIM(INPUT)
  54. UC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  55. LC = 'abcdefghijklmnopqrstuvwxyz'
  56. Low = REPLACE(Name, UC, LC)
  57. BName = "b" Low
  58. FName = "f" Low
  59. MName = "m" Low
  60. Consonants = SPAN('bcdfghjklmnpqrstvwxyz')
  61. &ANCHOR = 1
  62. Low Consonants . First REM . Rest :F(READY)
  63. BName = "b" Rest
  64. FName = "f" Rest
  65. MName = "m" Rest
  66. First "b" :S(BINIT)
  67. First "f" :S(FINIT)
  68. First "m" :S(MINIT) F(READY)
  69. BINIT Low "b" REM . BName :(READY)
  70. FINIT Low "f" REM . FName :(READY)
  71. MINIT Low "m" REM . MName
  72. READY OUTPUT = Name ", " Name ", bo-" BName
  73. OUTPUT = "Banana-fana fo-" FName
  74. OUTPUT = "Fee-fi-mo-" MName
  75. OUTPUT = Name "!"
  76. END
  77.  
  78. :(TARGET)
  79.  
  80. :S(SUCCESS) F(FAILURE)
  81.  
  82. # $RUN *SNOBOL4 5=GOLF.SNO+*SOURCE* 6=*DUMMY*(1,28)+*SINK*(1,4)+*DUMMY*
  83. # Execution begins 16:57:25
  84. Snowman
  85. Snowman, Snowman, bo-bowman
  86. Banana-fana fo-fowman
  87. Fee-fi-mo-mowman
  88. Snowman!
  89. # Execution terminated 16:57:30 T=0.013
  90.  
  91. 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
  92.  
  93. 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}!`
  94.  
  95. r=x=>x.match(/[aeiouAEIOU]w*/)[0]
  96.  
  97. f=x=>`${x}, ${x}, bo-b${r(x)}nBanana-fana fo-f${r(x)}nFee-fi-mo-m${r(x)}n${x}!`
  98.  
  99. (defn name-game
  100. [n]
  101. (let [[b f m] (map (fn [x] (if (some #(= % (first n) (last x)) "bfm")
  102. (str (apply str (butlast x)) (apply str (rest n)))
  103. (str x (apply str (drop-while (fn [x] (not (some #(= % x) "aeiou"))) n))))) [", bo-b" "nBanana-fana-fo-f" "nFee-fi-mo-m"])]
  104. (str n ", " n b f m "n" n "!")))
  105.  
  106. val v="""#, #, bo-b0
  107. Banana-fana fo-f1
  108. Fee-fi-mo-m2
  109. #!"""
  110. type S=String
  111. def a(b:S,c:S,d:S)=b.replaceAll(c,d)
  112. def r(t:S,n:S,i:Int)=if(n(0)=="bfm"(i).toUpper)a(t,"."+i,n.tail)else
  113. a(t,""+i,a(n,"^[^AEIOUaeiou]*([aeiou].*)","$1")).toLowerCase
  114. def x(n:S)=a(r(r(r(v,n,0),n,1),n,2),"#",n)
  115.  
  116. val l = List ("Shirley", "Arnold", "Bob", "Fred")
  117. for (n <- l) println (x (n) + "n")
  118.  
  119. val templ = """#, #, bo-b0
  120. Banana-fana fo-f1
  121. Fee-fi-mo-m2
  122. #!"""
  123.  
  124. val names = List ("Shirley", "Arnold", "Bob", "Fred")
  125. val keys = "bfm"
  126.  
  127. def recode (template: String, n: String, i: Int) =
  128. if (n(0) == keys(i).toUpper)
  129. template.replaceFirst ("." + i, n.tail) else
  130. template.replaceAll ("" + i, (n.replaceAll ("^[^AEIOUYaeiouy]*([aeiou].*)", "$1").toLowerCase))
  131.  
  132. for (name <- names)
  133. println (recode (recode (recode (templ, name, 0), name, 1), name, 2).replaceAll ("#", name) + "n")
  134.  
  135. n=input();i=0
  136. r=n[i:].lower()
  137. while n[i]not in'aeiouAEIOU':i+=1;r=n[i:]
  138. print(f'{n}, {n}, bo-b{r}nBanana-fana fo-f{r}nFee-fi-mo-m{r}n{n}!')
  139.  
  140. def f(n,i=0):
  141. r=n[i:].lower()
  142. while n[i].lower()not in'aeiou':i+=1;r=n[i:]
  143. return f'{n}, {n}, bo-b{r}nBanana-fana fo-f{r}nFee-fi-mo-m{r}n{n}!'
  144.  
  145. 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'
  146.  
  147. sed 'h ;# copy to hold buffer
  148. G ;# append newline + hold buffer to pattern
  149. G ;# ditto for next two G's
  150. G' |sed '1s/.*/&, &, bo-bL&/i ;# 1st line -> X, X bo-bx (lowercase)
  151. 2s/^.*/Banana-fana fo-fL&/ ;# 2nd line -> Banana-fana fo-fx
  152. 3s/^.*/Fee-fi-mo-mL&/ ;# 3rd line -> Fee-fi-mo-mx
  153. 4s/$/!/ ;# bang the 4th line!
  154. tx ;# jump to :x if any s/// has matched
  155. :x ;# spoiler alert: it has! reset t-flag
  156. s/o-([bfm])1/o-/i ;# match some o-cc where c = [bfm]
  157. tz ;# if that matched, branch to :z
  158. s/(o-[bfm])[^aeiou]+/1/ ;# replace o-[bfm] plus consonants with o-[bfm]
  159. :z ;# target of tz, skips over previous s///'
  160.  
  161. x=raw_input('')
  162. a,b,c=x[0],x[1:],'bfm'
  163. if b[0] in c:b=b[1:]
  164. d="X, X, bo-@nBanana-fana fo-@nFee-fi-mo-@nX!".replace('X',a)
  165. for y in c:d=d.replace('@',y+b,1)
  166. print d
  167.  
  168. 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!"}
  169.  
  170. assert ['Shirley', 'Arnold', 'Bob', 'Fred'].collect { r(it) } == [
  171. '''Shirley, Shirley, bo-birley
  172. Banana-fana fo-firley
  173. Fee-fi-mo-mirley
  174. Shirley!''',
  175. '''Arnold, Arnold, bo-barnold
  176. Banana-fana fo-farnold
  177. Fee-fi-mo-marnold
  178. Arnold!''',
  179. '''Bob, Bob, bo-ob
  180. Banana-fana fo-fob
  181. Fee-fi-mo-mob
  182. Bob!''',
  183. '''Fred, Fred, bo-bed
  184. Banana-fana fo-red
  185. Fee-fi-mo-med
  186. Fred!'''
  187. ]
  188.  
  189. 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')))
  190.  
  191. 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')))
  192.  
  193. V"BFM"IqhzN=aYtrz0.?=aY+rN0:rz0"^[^aeiou]+"k))+%." s­ÞXY:lÍ"*]z2@Y0+." o1}1ÃЬÛJî½"@Y1+."-o Âkq°ë¹è"@Y2+z!
  194.  
  195. n=raw_input('')
  196. if n[0].lower() in ("m", "f", "b"): r=n[1:]
  197. else:
  198. i = iter(n.lower())
  199. for a in range(len(n)):
  200. if i.next() in ("a","e","i","o","u"):
  201. r = n[a:]
  202. break
  203. 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