@matthiasplappert solution