Middle Digit Comparison: Medium Programming Problem