Troughput between repeating activities A and B

Hello everyone,
I have 2 activities, A and B and I would like to calculate the throughput between them. It can happen, that A and B appear multiple times but B always appear after A;
so I am interesten in the pairwise calculation of the throughput time (and average of that).
Example:

F-A(1)-C-B(1)-A(2)-B(2)-N-A(3);

In this case I need the average time between A(1)-B(1) and A(2)-B(2).

any ideas?

Best,
Maria