Super Functional Strings

  • + 2 comments
    def superFunctionalStrings(s):
        sss = []
        sum_= 0
        for i in range(len(s)):
            for j in range(i+1,len(s)+1):
                if s[i:j] not in sss:
                    sss.append(s[i:j])
                    sum_ += (len(s[i:j])**len(set(list(s[i:j]))))%(1000000007)
        return(sum_%(1000000007))
    

    it only passes test cases