#include<iostream.h> void main() { int c,min=10,max=0; long n; cin>>n; while(n) {c=n%10; if(c>max) max=c; else if(c<min) min=c; n=n/10; } cout<<min<<" "<<max; }