How to divaded one number to digits and save every digit in variable

Why from time to time I got this error, sometime its run well and some time not :
Type Into ‘INPUT’: Index was outside the bounds of the array.