fork download
  1. program p1;
  2. var
  3. x, c, i, lens : Longint;
  4. s : String;
  5.  
  6. begin
  7. c := 10;
  8. Read(x);
  9. Str(x, s);
  10. lens := Length(s);
  11. for i:=1 to lens do
  12. begin
  13. case s[i] of
  14. '1' : if c > 1 then c := 1;
  15. '3' : if c > 3 then c := 3;
  16. '5' : if c > 5 then c := 5;
  17. '7' : if c > 7 then c := 7;
  18. '9' : if c > 9 then c := 9;
  19. end;
  20. end;
  21.  
  22. if c < 10 then Writeln(c);
  23.  
  24. end.
Success #stdin #stdout 0s 4184KB
stdin
43512
stdout
1