Select three consecutive digits and call the same function for other blocks
if ( givenString . size ( ) < index + 3 || stoi ( givenString . substr ( index , 3 ) ) > 255 ) return ; ipAddress += givenString . substr ( index , 3 ) + ' . ' ; GetAllValidIpAddress ( result , givenString , index + 3 , count + 1 , ipAddress ) ;