Try it
Current DFA state:
How it works
This validator uses a minimized 5 state DFA. Each state tracks which category of requirements has been satisfied so far uppercase seen, or digit/special seen rather than tracking all combinations individually.
Q — States
{ q0, q1, q2, q3, q4 } — 5 states total
Σ — Alphabet
Uppercase (U), Digit (D), Special (S), Lowercase (L)
δ — Transition
δ(state, char) → next state
q0 — Start state
Begin here. No requirements satisfied yet.
q4 — Accept state
Both requirement groups met. Sink accept — loops on all input.
L — Neutral input
Lowercase loops back. No penalty, no progress.
State definitions
| State | Meaning | Has U | Has D/S | Accepts? |
|---|---|---|---|---|
| q0 | Start — nothing satisfied | ✗ | ✗ | No |
| q1 | Has uppercase | ✓ | ✗ | No |
| q2 | Has digit or special | ✗ | ✓ | No |
| q3 | Has both — one step from accept | ✓ | ✓ | No |
| q4 | All requirements satisfied | ✓ | ✓ | Yes |
Transition table (δ function)
δ(current state, input type) → next state | italic = self-loop
| State | uppercase (U) | digit (D) | special (S) | lowercase (L) |
|---|---|---|---|---|
| q0 | q1 | q2 | q2 | q0 |
| q1 | q1 | q3 | q3 | q1 |
| q2 | q3 | q2 | q2 | q3 |
| q3 | q4 | q4 | q4 | q4 |
| q4 | q4 | q4 | q4 | q4 |
Step-by-step trace
Enter a password above and see how the DFA processes it character by character.
No input yet. Type a password to see the trace.