Python 3, <s>168</s> <s>157</s> <s>152</s> <s>139</s> <s>144</s> 136 bytes = EDIT: Really obvious things I should have seen easier have been changed, and some slightly less obvious. Edit 2: stoopid (˚n˚). The program threw errors. I fixed it up. not actually 153 :( Thanks to Leaky Nun for saving 5 bytes, and to jmilloy for saving <s>13</s> 8 bytes. <!-- language: lang-python --> s=input() p=q=k=len(s) m=0 while-~p: while-~q:m=(m,q-p)[(s[p:q]in"lucky")*q-p>m];q-=1 p-=1;q=k print(2**m-2*sum(i in"omen"for i in s)) The program runs through all possibly possible substrings in input (possibly possible, because it computes impossible substrings as well, 8 to 7, for example), checks if the substring is in "lucky", then sets the exponent of 2 to the length of the substring should it be greater than the current value. Possibly could be improved by using only one while loop. Could possibly use some improvement; I'm still getting the hang of this.