This question is inspired by this awesome answer.
The challenge is to write a program or function which takes in a positive integer, and outputs "Happy new year to you" or a slight variation thereof, such that the character codes of that string add up to the inputted number. The space counts towards the sum of character codes too.
The case does not matter at all; you may output HappY New yEAR
or something so long as it satisfies the specifications below.
The specifications are as follows:
The outputted string must contain happy new year
. As stated above, the case does not matter.
The happy new year
component of the string may optionally be preceded by have a
, again in any case. However, there must be a space before happy
if the string starts with have a
.
The happy new year
string may optionally be followed by to you
, again in any case. The space before to
is mandatory.
Note that Have a happy new year to you
, while not grammatically correct, is an acceptable output for the purposes of this challenge.
Finally, at the very end of the string, any number of exclamation marks can be outputted.
In summary, the outputted string must satisfy the following regular expression:
/^(have a )?happy new year( to you)?!*$/i
You may assume while writing your program or function that you will only be given numbers for which it is possible to construct a "happy new year" string.
I won't allow outputting in array or list format because it defeats the purpose of the challenge.
If there are multiple solutions, feel free to output any one of them, any subset of them, or all of them.
As this challenge is code-golf, the shortest code, measured in bytes, wins.
Test cases
2014
-> Happy new year to you!
1995
-> HAPPY NEW YEAR TO You!!!!!!!!!!!!!!
989
-> HAPPY NEW YEAR
1795
-> Have a HAPPY new year!
2997
-> Have a HAppY new year to YOU!!!!!!!!!!!!!!!!!!!