Python 2, 52 bytes
a=b=input()
while len(set(str(a)))!=1:a+=1
print a-b
Python 2 has several tricks that make this shorter. For example, input is numeric, so we don't need to cast to int. (-5 bytes) We also don't need to put parenthesis around the a-b
(-1 byte)
Use this script to verify all test cases:
def f(i):
a=b=i
while len(set(str(a)))!=1:a+=1
return a-b
inputs = [8, 100, 113, 87654321, 42, 20000, 11132]
outputs = [0, 11, 109, 1234567, 2, 2222, 11090]
for i in range(len(inputs)):
print(f(inputs[i]) == outputs[i])
You may also try it online!