Alef edge hiring challenge (Hacker earth)

Do anyone have solutions for the alef edge hiring challenge competition.

One of the question is Great substrings

And other is Degree of freedom

The first question is partially clipped, share the complete problem statement

sorry i dont have any other references.
If anyone Have please mention below.

Thanks in advance

The first question can be done by bitmasking-

code
'''Author- Akshit Monga'''
t = int(input())
for _ in range(t):
    s=input()
    hash={0:1}
    pre=0
    ans=0
    for i in s:
        pre^=(1<<ord(i)-97)
        ans+=hash.get(pre^0,0)
        hash[pre]=hash.get(pre,0)+1
    print(ans)

I don’t understand why it asks to print modulo since answer can easily fit in common data types.

You can also try this problem. The editorial is pretty much good if you don’t understand anything.

What are the constraints on N in the second problem?

I think
1<=N <=10^6

-10^9<=Ai<=10^9

ans+=hash.get(pre^0,0)

here you have written pre^0 but does not xoring something with 0 is the number itself ?

Yay, it’s the same. You can remove that.