Add String length check to prevent out of bounds error

Add index bounds check in AccuracyType