Help me in solving RANGEGAME problem

My issue

I am not able to get the direction to get to this question. Please help me and give me some direction.
As I am little confused that the length can be 10^18 but till that value long long cannot reach and I am unable to imagine using string here

My code

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	return 0;
}

Problem Link: Prime Range Game Practice Coding Problem - CodeChef