Help me in solving BREAKSTRING problem

My issue

How to solve this problem. I mean it is clearly segment tree type thing. But why many are using string hashing. Also there may be a possibility of Collisions

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here

}

Problem Link: Break The String Practice Coding Problem

I couldn’t see any sort of seg tree application(though my expertise is littler in that). I think that’s very lucky to be accepted, but I couldn’t come to a conclusion on this. You may frame some test cases to get them to fail.