Optimized 99 Bottles program with ternary operator