<p>A password is said to be <strong>strong</strong> if it satisfies all the following criteria:</p>

<ul>
	<li>It has at least <code>8</code> characters.</li>
	<li>It contains at least <strong>one lowercase</strong> letter.</li>
	<li>It contains at least <strong>one uppercase</strong> letter.</li>
	<li>It contains at least <strong>one digit</strong>.</li>
	<li>It contains at least <strong>one special character</strong>. The special characters are the characters in the following string: <code>&quot;!@#$%^&amp;*()-+&quot;</code>.</li>
	<li>It does <strong>not</strong> contain <code>2</code> of the same character in adjacent positions (i.e., <code>&quot;aab&quot;</code> violates this condition, but <code>&quot;aba&quot;</code> does not).</li>
</ul>

<p>Given a string <code>password</code>, return <code>true</code><em> if it is a <strong>strong</strong> password</em>. Otherwise, return <code>false</code>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> password = &quot;IloveLe3tcode!&quot;
<strong>Output:</strong> true
<strong>Explanation:</strong> The password meets all the requirements. Therefore, we return true.
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> password = &quot;Me+You--IsMyDream&quot;
<strong>Output:</strong> false
<strong>Explanation:</strong> The password does not contain a digit and also contains 2 of the same character in adjacent positions. Therefore, we return false.
</pre>

<p><strong class="example">Example 3:</strong></p>

<pre>
<strong>Input:</strong> password = &quot;1aB!&quot;
<strong>Output:</strong> false
<strong>Explanation:</strong> The password does not meet the length requirement. Therefore, we return false.</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= password.length &lt;= 100</code></li>
	<li><code>password</code> consists of letters, digits, and special characters: <code>&quot;!@#$%^&amp;*()-+&quot;</code>.</li>
</ul>

class Solution:
    def strongPasswordCheckerII(self, password: str) -> bool:
        passwordLen = len(password)
        specialChars = "!@#$%^&*()-+"
        # if passwordLen >= 8:
        #     flags = [False] * 4
        #     for char in password:
        #         if char.islower():
        #             flags[0] = True
        #         elif char.isupper():
        #             flags[1] = True
        #         elif char.isdigit():
        #             flags[2] = True
        #         elif char in specialChars:
        #             flags[3] = True
        #         else:
        #             return False
        #         if False not in flags:
        #             break
        #     if False not in flags:
        #         for i in range(passwordLen - 1):
        #             if password[i] == password[i + 1]:
        #                 return False
        #         return True
        #     return False
        # return False
        
        if passwordLen >= 8:
            lowerCase = False
            for char in password:
                if char.islower():
                    lowerCase = True
                    break
            if lowerCase:
                upperCase = False
                for char in password:
                    if char.isupper():
                        upperCase = True
                        break
                if upperCase:
                    digit = False
                    for char in password:
                        if char.isdigit():
                            digit = True
                            break
                    if digit:
                        special = False
                        for char in specialChars:
                            if char in password:
                                special = True
                                break
                        if special:
                            same = True
                            for i in range(passwordLen - 1):
                                if password[i] == password[i + 1]:
                                    same = False
                                    break
                            if same:
                                return True
                            return False
                        return False
                    return False
                return False
            return False
        return False
35