Valid Sudoku Row
The Mereside puzzle desk proofreads every Sudoku before it goes to print, and the first pass is done one row at a time. A row is nine cells. A cell either carries a digit from 1 to 9 or is left blank for the solver to fill in, and the file records a blank as 0. The rule being checked is that no digit may appear twice in the same row. Blanks are not digits, so any number of them is fine -- an untouched row of nine blanks is a perfectly legal row.
Task: Report whether the row obeys the no-repeated-digit rule.
Input
A single line holding 9 integers separated by single spaces, each between 0 and 9, where 0 marks an empty cell.
Output
One line holding exactly Valid if no digit from 1 to 9 appears more than once, or exactly Invalid if one does. Capital first letter, no quotes, nothing else on the line.
Example:
Input:
5 3 0 0 7 0 0 0 0
Output:
Valid
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in