If current row number is not equal to previous row then increment the moves
if ( row [ ord ( s [ i ] ) - ord ( ' a ' ) ] != row [ ord ( s [ i - 1 ] ) - ord ( ' a ' ) ] ) : NEW_LINE move += 1 ; NEW_LINE