you give stre s each pair number l r fulfill condition 1lrs correspond substre string s start position l end position r inclusivelet define function string Fxy like well find list pair number correspond substring string x equal string y Lets sort list pair accord pair number increase the value function Fxy equal number nonempty continuous sequence listfor example Fbabbabbababbabbabb6 the list pair follows1447912its continuous sequence 14 47 912 1447 47912 1447912 your task calculate give string s sum Fsx x x belong set substring string s