All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
The sum of all the days when you see blood is considered menses as long as they do not exceed 15 days, including the days of purity in between. The period of purity is regarded as a valid state of ritual purity; acts of worship performed in this period are valid, your husband is allowed to have intercourse with you, and all the rulings of women who are in a state of purity apply to you.
However, if the total period of the two bleedings and the period of non-bleeding in between exceeds fifteen days, then the blood you see after the fifteen days is considered Istihaadhah (bleeding outside the monthly menses). In this case, you should calculate the regular period length you normally experience and then consider yourself menstruating during the days of your calculated period and follow all menstruation-related rules; and any blood discharges beyond this is considered Istihaadhah (bleeding outside the monthly menses).
Allaah Knows best.