0 - 1 of 1 tags for reset counter when condition is true

Hi, I have the following data and I am trying to find a way to identify the rank of the default event for each account. For example, when Default_Event = 1 it means it is a continuous default. So, per the data, the first default event started in 201001 and lasted till 201002, the second default event started in 201005 and lasted till 201006.