Skip to main content
add explanation
Source Link
chunes
  • 27.9k
  • 3
  • 32
  • 55

Factor, 55 bytes

[ [ over index cut capitalize swap write ] each print ]

Try it online!

Takes the string and the lowercase word in that order. Assuming the input is "all the worlds a stage" "lag"

  • [ ... ] each For each letter in the word...
        <<iteration 1 of each>>
            ! "all the worlds a stage" 108
over        ! "all the worlds a stage" 108 "all the worlds a stage"
index       ! "all the worlds a stage" 1
cut         ! "a" "ll the worlds a stage"
capitalize  ! "a" "Ll the worlds a stage"
swap        ! "Ll the worlds a stage" "a"
write       ! "Ll the worlds a stage"    (write to stdout without newline)
       <<iteration 2 of each>>
            ! "Ll the worlds a stage" 97
over        ! "Ll the worlds a stage" 97 "Ll the worlds a stage"
index       ! "Ll the worlds a stage" 14
cut         ! "Ll the worlds " "a stage"
capitalize  ! "Ll the worlds " "A stage"
swap        ! "A stage" "Ll the worlds "
write       ! "A stage"    (write to stdout without a newline)
     <<and so forth..>>
            ! "Ge"
print       ! (write to stdout with a newline)

Factor, 55 bytes

[ [ over index cut capitalize swap write ] each print ]

Try it online!

Factor, 55 bytes

[ [ over index cut capitalize swap write ] each print ]

Try it online!

Takes the string and the lowercase word in that order. Assuming the input is "all the worlds a stage" "lag"

  • [ ... ] each For each letter in the word...
        <<iteration 1 of each>>
            ! "all the worlds a stage" 108
over        ! "all the worlds a stage" 108 "all the worlds a stage"
index       ! "all the worlds a stage" 1
cut         ! "a" "ll the worlds a stage"
capitalize  ! "a" "Ll the worlds a stage"
swap        ! "Ll the worlds a stage" "a"
write       ! "Ll the worlds a stage"    (write to stdout without newline)
       <<iteration 2 of each>>
            ! "Ll the worlds a stage" 97
over        ! "Ll the worlds a stage" 97 "Ll the worlds a stage"
index       ! "Ll the worlds a stage" 14
cut         ! "Ll the worlds " "a stage"
capitalize  ! "Ll the worlds " "A stage"
swap        ! "A stage" "Ll the worlds "
write       ! "A stage"    (write to stdout without a newline)
     <<and so forth..>>
            ! "Ge"
print       ! (write to stdout with a newline)
deleted 34 characters in body
Source Link
chunes
  • 27.9k
  • 3
  • 32
  • 55

Factor, 55 bytes

[ [ over index cut capitalize swap write ] each writeprint ]

Try it online!Try it online!

Factor, 55 bytes

[ [ over index cut capitalize swap write ] each write ]

Try it online!

Factor, 55 bytes

[ [ over index cut capitalize swap write ] each print ]

Try it online!

Source Link
chunes
  • 27.9k
  • 3
  • 32
  • 55

Factor, 55 bytes

[ [ over index cut capitalize swap write ] each write ]

Try it online!