{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cpre\u003e\nTime Limit: 3000 MS Memory Limit: 65536 K \n\n\n \u003chr\u003e\n\n\u003ch2\u003eDescription\u003c/h2\u003e\n\nWhile driving the other day, John looked down at his odometer, and it read 100000. John was pretty excited \nabout that. But, just one mile further, the odometer read 100001, and John was REALLY excited! You see, \nJohn loves palindromes – things that read the same way forwards and backwards. So, given any odometer reading, \nwhat is the least number of miles John must drive before the odometer reading is a palindrome? For John, every \nodometer digit counts. If the odometer reading was 000121, he wouldn\u0027t consider that a palindrome.\n\n\u003ch2\u003eInput\u003c/h2\u003e\n\nThere will be several test cases in the input. Each test case will consist of an odometer reading on its own line. \nEach odometer reading will be from 2 to 9 digits long. The odometer in question has the number of digits given in \nthe input - so, if the input is 00456, the odometer has 5 digits. There will be no spaces in the input, and no blank \nlines between input sets. The input will end with a line with a single 0.\n\n\u003ch2\u003eOutput\u003c/h2\u003e\n\nFor each test case, output the minimum number of miles John must drive before the odometer reading is a palindrome. \nThis may be 0 if the number is already a palindrome. Output each integer on its own line, with no extra spaces and \nno blank lines between outputs.\n\n\u003ch2\u003eSample Input\u003c/h2\u003e\n\n100000\n100001\n000121\n00456\n0\n\n\u003ch2\u003eSample Output\u003c/h2\u003e\n\n1\n0\n979\n44\n\n\n\u003c/pre\u003e"}}]}