Restart Serial print

hello,
I am struggling to finish the code.

What I am trying to do is :

I am counting two hall sensor's pulses. and printing as serial print.
and if sensor 1's pulse and sensor'2 pulse are different and the difference are bigger then 5, the serial print should start from 0. and start to count their pulses from 0 again.

The code below does count 2 sensor's pulses.
and when the differences bigger then 5 , it makes rpmcount and rpmcount_1's value to 0.
but even though still those sensors are counting the their pulses, the value are not changing. it stays 0.

is their any way to count the sensor's pulse from 0 every time their difference is bigger then 5?

const int hallPin=A3 ;
const int hallPin_1=A4;      

const int ledPin=13;

int hallState ;
int hallState_1;

int lasthallState;
int lasthallState_1;

int rpmcount =0;
int rpmcount_1 =0;
        
int motorSt=2;
int motorDr=3;
int motorEn=4;

int motorSt_1=5;
int motorDr_1=6;
int motorEn_1=7;


void setup()
{
  pinMode(ledPin, OUTPUT);
  pinMode(hallPin, INPUT);
  pinMode(hallPin_1, INPUT);
  Serial.begin(9600);
 
  pinMode(motorEn, OUTPUT);
  pinMode(motorDr, OUTPUT);
  pinMode(motorSt, OUTPUT);
  
  pinMode(motorEn_1, OUTPUT);
  pinMode(motorDr_1, OUTPUT);
  pinMode(motorSt_1, OUTPUT);
  
  lasthallState = digitalRead(hallPin);
  lasthallState_1 = digitalRead(hallPin_1);
}

void loop()
 {
  
    digitalWrite(motorSt, HIGH);
    delayMicroseconds(500);
    digitalWrite(motorSt, LOW);
    delayMicroseconds(500);
   
     
    digitalWrite(motorSt_1, HIGH);
    delayMicroseconds(500);
    digitalWrite(motorSt_1, LOW);
    delayMicroseconds(500);
   
  hallState = digitalRead(hallPin);
     if (hallState!=lasthallState )
     {
        if (hallState==LOW)
       {
        rpmcount++;
        Serial.print("Motor 1's pulse");
        Serial.println(rpmcount);
        }
     }
     
//-----------------------------------------------------//
  
  hallState_1 = digitalRead(hallPin_1);
     if (hallState_1 !=lasthallState_1 )
     {
        if (hallState_1==LOW)
       {
        rpmcount_1++;
        Serial.print("Motor 2's pulse");
        Serial.println(rpmcount_1);
        }
     }

   
if (abs(rpmcount-rpmcount_1) > 5)
{
rpmcount=0;
rpmcount_1=0;
}


lasthallState=hallState;
lasthallState_1=hallState_1;

   



 }

You could eliminate about half your code by using arrays instead of two copies of everything, but apart from that the code looks as if it would do what you say you want. Do you have an example of the output showing rpmcount and rpmcount_1 differing by more than 5 and not being reset to 0?