Add simple substring algorithm