1class Solution:2def strongPasswordChecker(self, password: str) -> int:3# vimla_kushwaha4s = password5missing_type = 36if any("a" <= c <= "z" for c in s):7missing_type -= 18if any("A" <= c <= "Z" for c in s):9missing_type -= 110if any(c.isdigit() for c in s):11missing_type -= 11213change = 014one = two = 015p = 216while p < len(s):17if s[p] == s[p - 1] == s[p - 2]:18length = 219while p < len(s) and s[p] == s[p - 1]:20length += 121p += 12223change += length // 324if length % 3 == 0:25one += 126elif length % 3 == 1:27two += 128else:29p += 13031if len(s) < 6:32return max(missing_type, 6 - len(s))33elif len(s) <= 20:34return max(missing_type, change)35else:36delete = len(s) - 203738change -= min(delete, one)39change -= min(max(delete - one, 0), two * 2) // 240change -= max(delete - one - 2 * two, 0) // 34142return int(delete + max(missing_type, change))