How do I add an expression(modulus) according to how many digits user's input have?

Example :

If,

User input : 5832 ( 4 Digit )

4 digit = 4 modulus expressions

5832 % 10000 , 5832 % 1000, 5832 % 100, 5832 % 10

If,

User input : 58320 ( 5 digit )

5 digit = 5 modulus expressions

58320 % 100000 , 5832 % 10000, 5832 % 1000, 5832 % 100, 5832 % 10