How can I check if a certain character is followed by another character in a string?

I want to check if every 'A' in a string is followed by at least one 'B'. The 'B' doesn't have to directly follow it and there doesn't have to be an even number of A's and B's.

For example:

AAZZBB = true

AAAXXXXYB = true

BBYYYXXXAXX = false

YYYBABYYYXXXAXX = false

Here's code I worked on but it keeps returning true:

```
 public bool BalancedAB(string str)
        {
            int endPos = str.Length - 1;
            for (int pos = 0; pos <= endPos; pos++)
            {
                if (str[pos] == 'A')
                {
                    if (pos < endPos)
                    {
                        char next = str[pos + 1];

                        if (next == 'B')
                        {
                            pos++;
                            continue;
                        }
                    }

                    return true;
                }
            }

            return false;
        }

```