NGM  A Game with Numbers
Nikifor and Trofim play the following game: they write some positive integer smaller than 2,000,000,000 and take turns one after another. Nikifor is the first to make a move. The turn is made by the following rule: from the written integer any nonzero digit is subtracted, and the new integer replaces the old one on the desk. For example for integer 40534, the next move can be: 40530, 40531 or 40529. The winner is the player who writes zero on the desk.
Write a program to decide who will win if both players do their best.
Input
The input contains the positive integer from which the game is started.
Output
In the first line you must write 1 if Nikifor wins and 2 otherwise. If Nikifor wins then in the second line you must output the move in the first turn which guarantees victory for him. If there are many such moves then output any of them.
Example
Input: 14 Output: 1 4
Author: Filimonenkov D.O.
hide comments
nileskh2504:
20170216 08:33:20
Please don't post the logic in the comments!


tuandayhehe:
20170216 03:59:45
wtf 's " do their best.". If they do their best then.


nilabja16180:
20170214 15:02:40
use int, not long long, got a WA 

programminator:
20170213 10:53:33
Easy 

holmesherlock:
20170208 19:05:17
the sample test cases say it all.... 

splashishkumar:
20170130 19:15:21
one of the easiest... 

scorpion_ajay:
20170114 09:39:48
try hubullu before this, it will be double fun :) 

pradeepgangwar:
20170109 10:27:56
Last edit: 20170109 10:31:34 

anikdeyshaon:
20161231 13:33:42
Last edit: 20161231 13:34:35 

aditya9125:
20161228 07:38:20
Sometimes just using pen paper solves the problem..try it. 
Added by:  Roman Sol 
Date:  20060505 
Time limit:  0.620s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ERL JSRHINO NODEJS PERL6 VB.NET 
Resource:  ZCon 2007 