What's the 'best' way to compare strings of characters of different lengths against an ideal sequential string of characters?
Welcome to the website! Consider using Dynamic Time Warping (DTW) which would address the issue that the lengths of the sequences may not be the same.
DTW is a time series alignment algorithm developed originally for speech recognition. It aims to align two sequences of feature vectors by warping the time axis iteratively until an optimal match between the two sequences is found.
This link gives a good visual and introductory explanation.