题解 | 笨小猴
笨小猴
https://www.nowcoder.com/practice/17865bc2a75c4944a872ef709958c56e
from math import ceil inp = list(input()) def test(i): a = inp.copy() while i in a: a.remove(i) return len(inp) - len(a) max = 0 min = len(inp) for i in set(inp): c = test(i) if c>max: max = c if c<min: min = c ans = max-min if ans>2: for j in range(2,ceil((ans**0.5))): if ans%j==0: print('No Answer') print(0) break else: print('Lucky Word') print(ans) elif ans==2: print('Lucky Word') print(ans) else: print('No Answer') print(0)