Input: str = "11"
Output: 11
Explanation: The substrings of "11" are: 1, 1, and 11.
Their XOR = 1 ⊕ 1 ⊕ 11 = 11
Input: str = "110"
Output: 111
Explanation: The substrings of 110 are: 1, 1, 0, 11, 10, 110.
Their XOR = 1 ⊕ 1 ⊕ 0 ⊕ 11 ⊕ 10 ⊕ 110 = 111
Input: str = "10101"
Output: 11001
Explanation: The substrings of 10101 are: 1, 10, 101, 1010, 10101, 0, 01, 010, 0101, 1, 10, 101, 0, 01, and 1.
Their XOR = 1 ⊕ 10 ⊕ 101 ⊕ 1010 ⊕ 10101 ⊕ 0 ⊕ 01 ⊕ 010 ⊕ 0101 ⊕ 1 ⊕ 10 ⊕ 101 ⊕ 0 ⊕ 01 ⊕ 1 = 11001
Follow the steps mentioned below to utilize the above observation to solve this problem: