[Python] The Principle of Inclusion-Exclusion (PIE), beat 100%
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \nThere are only 3 condit
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nThere are only 3 conditions\nsubtract those invalid combination \n``where cnt(\'l\') == 0 | cnt(\'e\') < 2 | cnt(\'t\') == 0``\n\nPIE of 3: (A | B | C) = A + B + C - AB - BC - CA + ABC\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nPower of n: `O(log(n))`\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n`O(1)`\n\n# Code\n```\nclass Solution:\n    def stringCount(self, n: int) -> int:\n        mod = 10 ** 9 + 7\n        if n < 4:\n            return 0\n\n        # total combination:\n        ans = pow(26, n, mod)\n        \n        # l = 0\n        sub = (pow(25, n, mod)) % mod\n        # t = 0\n        sub += (pow(25, n, mod)) % mod\n        # e = 0, 1\n        sub += (pow(25, n, mod) + n * pow(25, n-1, mod)) % mod\n        # l = 0, t = 0\n        sub -= pow(24, n, mod)\n        # l = 0, e < 2\n        sub -= (pow(24, n, mod) + n * pow(24, n-1, mod)) % mod\n        # t = 0, e < 2\n        sub -= (pow(24, n, mod) + n * pow(24, n-1, mod)) % mod\n        # l = 0, t = 0, e < 2\n        sub += (pow(23, n, mod) + n * pow(23, n-1, mod)) % mod\n        return (ans - sub) % mod\n\n```
['Python3']