Company: Cashfree_12may
Difficulty: easy
Programmer String A programmer string is a substring whose letters can be rearranged so that they spell programmer , possibly with some letters left over. In other words, a substring is a programmer string when it contains at least one p , at least one o , at least one g , at least one a , at least one e , at least two m and at least three r . For example programmer , grammproer and prozmerqgram are all programmer strings: the first two are exact rearrangements, and the third holds all ten required letters plus a spare z and q . You are given a lowercase string s that contains at least two programmer strings which do not overlap. Let the leftmost programmer string be the one that finishes earliest in s , and let the rightmost programmer string be the one that starts latest in s . Print how many indices of s lie strictly between them - that is, strictly after the last index of the leftmost programmer string and strictly before the first index of the rightmost one. Input Format A single