If next i is odd ( next i is even ) then we need not to change firstr , we need to remove first character of second and append a character to it .
second = ( d * ( second + q - ord ( string [ ( i + 1 ) / 2 ] ) * h ) % q + ord ( string [ i + 1 ] ) ) % q NEW_LINE