Problem:
Score : 300 points

Problem Statement

You are given an integer N.

For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.

For example, F(3,11) = 2 since 3 has one digit and 11 has two digits.

Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.

Constraints

1 \leq N \leq 10^{10}

N is an integer.

Input

The input is given from Standard Input in the following format:

N

Output

Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.

Sample Input 1

10000

Sample Output 1

3

F(A,B) has a minimum value of 3 at (A,B)=(100,100).

Sample Input 2

1000003

Sample Output 2

7

There are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.

Sample Input 3

9876543210

Sample Output 3

6

Solution in Rust (1.15.1) (judge verdict: Wrong Answer)

// This code is generated by [cargo-atcoder](https://github.com/tanakh/cargo-atcoder)
// Original source code:
/*
use proconio::{input, fastout};
use std::collections::HashMap;
use std::cmp::max;


fn prime_factorization(mut x: u64) -> HashMap<u64, u64> {
  let mut map = HashMap::new();
  if x % 2 == 0 {
   while x % 2 == 0 {
     *map.entry(2).or_insert(0) += 1; 
     x /= 2;
   }
  }
  for d in (3..).step_by(2) {
    if x == 1 {
      break;
    }
    if x < d * d {
      map.entry(x).or_insert(1);
      break;
    }
    while x % d == 0 {
      *map.entry(d).or_insert(0) += 1; 
      x /= d;
    }
  }
  map
}
#[fastout]
fn main() {
  input!{
    n: u64
  };

  let m = prime_factorization(n);
  let mut m : Vec<_> = m.into_iter().collect();
  m.sort_by(|x,y| x.1.cmp(&y.1));
  let mut a = 1;
  let mut b = 1;
  for (k, mut v) in m {
    while v > 0 {
      if a < b {
        a *= k;
      } else {
        b *= k;
      }
      v -= 1;
    }
  }
  // dbg!(a, b);
  println!("{}", max(a.to_string().len(), b.to_string().len()))
}
*/

fn main() {
    let exe = "/tmp/binA1A88B1C";
    std::io::Write::write_all(&mut std::fs::File::create(exe).unwrap(), &decode(BIN)).unwrap();
    std::fs::set_permissions(exe, std::os::unix::fs::PermissionsExt::from_mode(0o755)).unwrap();
    std::process::exit(std::process::Command::new(exe).status().unwrap().code().unwrap())
}

fn decode(v: &str) -> Vec<u8> {
    let mut ret = vec![];
    let mut buf = 0;
    let mut tbl = vec![64; 256];
    for i in 0..64 { tbl[TBL[i] as usize] = i as u8; }
    for (i, c) in v.bytes().filter_map(|c| { let c = tbl[c as usize]; if c < 64 { Some(c) } else { None } }).enumerate() {
        match i % 4 {
            0 => buf = c << 2,
            1 => { ret.push(buf | c >> 4); buf = c << 4; }
            2 => { ret.push(buf | c >> 2); buf = c << 6; }
            3 => ret.push(buf | c),
            _ => unreachable!(),
        }
    }
    ret
}

const TBL: &'static [u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
const BIN: &'static str = "<base64-encoded ELF executable removed>";