Skip to main content
formatting
Source Link
Riker
  • 7.9k
  • 4
  • 39
  • 73

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"

Bash

without sed

f(){ printf %$1s|tr \  $2;}
c=${1//o/`f ${#1} B`
}
echo "${c//re/ `f $[${#1}-2] F` 
}"

87 bytes (thanks 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"

90 bytes

Bash, 87 bytes

Without sed:

f(){ printf %$1s|tr \  $2;}
c=${1//o/`f ${#1} B`
}
echo "${c//re/ `f $[${#1}-2] F` 
}"

Thanks to @manatwork.

With 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"
incorporate @manatwork's improvements
Source Link

Bash

without sed

f(){ printf %$1s|tr ' '\ "$2"; $2;};c="$
c=${1//o/$(f`f ${#1} B)$'\n'B`
}";echo
echo "${c//re/ $(f`f $(($$[${#1}-2))2] F)F` $'\n' 
}"

10587 bytes (thanks to @manatwork)

with sed

f(){ printf %$1s|tr ' '\ "$2"; $2;};echo
echo $1|sed "s/o/$(f`f ${#1} B)\nB`\n/g;s/re/ $(f`f $(($$[${#1}-2))2] F)F` \n/g"

9890 bytes

Bash

without sed

f(){ printf %$1s|tr ' ' "$2"; };c="${1//o/$(f ${#1} B)$'\n'}";echo "${c//re/ $(f $((${#1}-2)) F) $'\n'}"

105 bytes

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"

98 bytes

Bash

without sed

f(){ printf %$1s|tr \  $2;}
c=${1//o/`f ${#1} B`
}
echo "${c//re/ `f $[${#1}-2] F`  
}"

87 bytes (thanks 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"

90 bytes

shorten solution
Source Link

Bash

without sed

f(){ printf "%$1s\n"|tr%$1s|tr ' ' "$2"; };c="${1//o/$(f ${#1} B)$'\n'}";echo "${c//re/ $(f $((${#1}-2)) F) $'\n'}"

109105 bytes

with sed

f(){ printf "%$1s\n"|tr%$1s|tr ' ' "$2"; };echo $1|sed "s/o/$(f ${#1} B)\n/g;s/re/ $(f $((${#1}-2)) F) \n/g"

10298 bytes

Bash

without sed

f(){ printf "%$1s\n"|tr ' ' "$2"; };c="${1//o/$(f ${#1} B)$'\n'}";echo "${c//re/ $(f $((${#1}-2)) F) $'\n'}"

109 bytes

with sed

f(){ printf "%$1s\n"|tr ' ' "$2"; };echo $1|sed "s/o/$(f ${#1} B)\n/g;s/re/ $(f $((${#1}-2)) F) \n/g"

102 bytes

Bash

without sed

f(){ printf %$1s|tr ' ' "$2"; };c="${1//o/$(f ${#1} B)$'\n'}";echo "${c//re/ $(f $((${#1}-2)) F) $'\n'}"

105 bytes

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"

98 bytes

Source Link
Loading