#! /bin/sh -

set -e

[ -z "$1" ] && { xargs -n 1 -d '\n' "$0"; exit 0; }

title=$*
title_len=${#title}
[ $title_len -gt 78 ] && { printf '%s\n' "$title"; exit 0; }
missing=$((80 - title_len - 2))
i=0
while [ $i -lt $((missing / 2)) ]; do
	printf '#'
	i=$((i+1))
done
printf ' %s ' "$title"
while [ $i -lt $missing ]; do
	printf '#'
	i=$((i+1))
done
printf '\n'
