[JAVA]Remove More Than Two Consecutive Occurrence
I have  a java `String` like this

    String str="&P;&P;&P;&P;&P;&P;&P;&P;&P;&P;&P;&P; Tannay Mnadal &P;&P;&P;&P;&P;&P; Tata"

I am trying to remove all `&P;` where the consecutive occurrence is more than  two.

ie. any `function(str)` , will return `"&P;&P;"  Tannay Mnadal &P;&P; Tata`

Any help will be appreciated.
Thanks



[JAVA]Remove More Than Two Consecutive Occurrence
===

I have  a java `String` like this

    String str="&P;&P;&P;&P;&P;&P;&P;&P;&P;&P;&P;&P; Tannay Mnadal &P;&P;&P;&P;&P;&P; Tata"

I am trying to remove all `&P;` where the consecutive occurrence is more than  two.

ie. any `function(str)` , will return `"&P;&P;"  Tannay Mnadal &P;&P; Tata`

Any help will be appreciated.
Thanks


