Hackerearth Balanced String using Bitmasking

I was solving this problem using bitmasking to generate all substrings in 2^n and then look for substrings in which each element is present even number of times.
Problem: https://www.hackerearth.com/practice/basic-programming/bit-manipulation/basics-of-bit-manipulation/practice-problems/algorithm/chandan-and-balanced-strings/

Code: https://ide.codingblocks.com/s/83458

substring and subsequence ka different things there are 2^n subsequence and n*(n+1)/2 substring of length n. and second in this Q n= 100000 how you are iterating 2^(10000) times a loop.? maxium of 10^8 times you can iterate a loop in 1 sec.

Can you suggest any method for this using bitmasking?

read editorial first if you dont get it after that also then please leave a reply

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.