Bash, 87 bytes
without sed
Without sed
:
f(){ printf %$1s|tr \ $2;}
c=${1//o/`f ${#1} B`
}
echo "${c//re/ `f $[${#1}-2] F`
}"
f(){ printf %$1s|tr \ $2;}
c=${1//o/`f ${#1} B`
}
echo "${c//re/ `f $[${#1}-2] F`
}"
87 bytes (thanksThanks to @manatwork).
with sed
f(){ printf %$1s|tr \ $2;}
echo $1|sed "s/o/`f ${#1} B`\n/g;s/re/ `f $[${#1}-2] F` \n/g"
90With sed
(90 bytes):
f(){ printf %$1s|tr \ $2;}
echo $1|sed "s/o/`f ${#1} B`\n/g;s/re/ `f $[${#1}-2] F` \n/g"