【Example 1】There are $m$ people standing in a line, with the rule that person A does not stand at the left end, and person B does not stand at the right end. How many different arrangements are there?
Solving $m$ people lining up in a row has $A_{m}^{m}$ different arrangements; among them, the arrangements with person A at the left end are $A_{m-1}^{m-1}$, and the arrangements with person B at the right end are also $A_{m-1}^{m-1}$. However, both include the arrangements where “A is at the left end and B is at the right end” which are $A_{m-2}^{m-2}$. Therefore, the number of arrangements that meet the requirements is $A_{m}^{m}-2 A_{m-1}^{m-1}+A_{m-2}^{m-2}$.