Post History
AWK, 82 bytes {split($1,d,"");i=a=d[1];for(x in d){d[x]>a?a=d[x]:0;d[x]<i?i=d[x]:0}print a+i+$1} Try it online! Just pass your input, e.g.: echo "123" | awk '...'
Answer
#3: Post edited
- # [AWK], 82 bytes
- {split($1,d,"");i=a=d[1];for(x in d){d[x]>a?a=d[x]:0;d[x]<i?i=d[x]:0}print a+i+$1}
- [Try it online!][TIO-lwo5jjsz]
- [AWK]: https://www.gnu.org/software/gawk/manual/gawk.html
- [TIO-lwo5jjsz]: https://tio.run/##SyzP/v@/urggJ7NEQ8VQJ0VHSUnTOtM20TYl2jDWOi2/SKNCITNPIUWzOiW6ItYu0R4kUxFrZWANomwy7TOh/NqCosy8EoVE7UxtFcPa//@NuEyNuczNuQyNjLksDIyMAA "AWK – Try It Online"
- Just pass your input, e.g.:
`echo "123" | awk '...' `
- # [AWK], 82 bytes
- {split($1,d,"");i=a=d[1];for(x in d){d[x]>a?a=d[x]:0;d[x]<i?i=d[x]:0}print a+i+$1}
- [Try it online!][TIO-lwo5jjsz]
- [AWK]: https://www.gnu.org/software/gawk/manual/gawk.html
- [TIO-lwo5jjsz]: https://tio.run/##SyzP/v@/urggJ7NEQ8VQJ0VHSUnTOtM20TYl2jDWOi2/SKNCITNPIUWzOiW6ItYu0R4kUxFrZWANomwy7TOh/NqCosy8EoVE7UxtFcPa//@NuEyNuczNuQyNjLksDIyMAA "AWK – Try It Online"
- Just pass your input, e.g.:
- echo "123" | awk '...'
#2: Post edited
- # [AWK], 82 bytes
- {split($1,d,"");i=a=d[1];for(x in d){d[x]>a?a=d[x]:0;d[x]<i?i=d[x]:0}print a+i+$1}
- [Try it online!][TIO-lwo5jjsz]
- [AWK]: https://www.gnu.org/software/gawk/manual/gawk.html
[TIO-lwo5jjsz]: https://tio.run/##SyzP/v@/urggJ7NEQ8VQJ0VHSUnTOtM20TYl2jDWOi2/SKNCITNPIUWzOiW6ItYu0R4kUxFrZWANomwy7TOh/NqCosy8EoVE7UxtFcPa//@NuEyNuczNuQyNjLksDIyMAA "AWK – Try It Online"
- # [AWK], 82 bytes
- {split($1,d,"");i=a=d[1];for(x in d){d[x]>a?a=d[x]:0;d[x]<i?i=d[x]:0}print a+i+$1}
- [Try it online!][TIO-lwo5jjsz]
- [AWK]: https://www.gnu.org/software/gawk/manual/gawk.html
- [TIO-lwo5jjsz]: https://tio.run/##SyzP/v@/urggJ7NEQ8VQJ0VHSUnTOtM20TYl2jDWOi2/SKNCITNPIUWzOiW6ItYu0R4kUxFrZWANomwy7TOh/NqCosy8EoVE7UxtFcPa//@NuEyNuczNuQyNjLksDIyMAA "AWK – Try It Online"
- Just pass your input, e.g.:
- `echo "123" | awk '...' `
#1: Initial revision
# [AWK], 82 bytes {split($1,d,"");i=a=d[1];for(x in d){d[x]>a?a=d[x]:0;d[x]<i?i=d[x]:0}print a+i+$1} [Try it online!][TIO-lwo5jjsz] [AWK]: https://www.gnu.org/software/gawk/manual/gawk.html [TIO-lwo5jjsz]: https://tio.run/##SyzP/v@/urggJ7NEQ8VQJ0VHSUnTOtM20TYl2jDWOi2/SKNCITNPIUWzOiW6ItYu0R4kUxFrZWANomwy7TOh/NqCosy8EoVE7UxtFcPa//@NuEyNuczNuQyNjLksDIyMAA "AWK – Try It Online"