Hashing Maps Ques

The code is showing tle for 3 test cases…
Qn Link-https://hack.codingblocks.com/contests/c/511/1555
Code-https://ide.codingblocks.com/s/51200

Hey Rakshit, it is given that 1 <= Length Of String <= 10^6 and time complexity of your code is O(N^2), that’s why it is resulting in TLE. Try to optimize your code.