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



Sample input:
10000


Sample output:
3

Submission status: Accepted

Solution code:
from functools import reduce
import math

def main():
    # N! を求める
    # f = math.factorial(N)
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input().rstrip())
    ans = 1e10
    d = 0
    for i in range(int(math.sqrt(N))+1,0,-1):
        if(N%i == 0):            
           d = max(len(str(i)) , len(str(N//i))) 
           ans = min(d,ans)
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

num = int(input())
num_sqrt = int(math.sqrt(num))

ans = 11
for A in range(1, num_sqrt+1):
    if num % A == 0:
        B = int(num / A)
        A, B = str(A), str(B)
        now_ans = max(len(A), len(B))
        ans = min(ans, now_ans)
print(ans)

Submission status: Accepted

Solution code:
import sys

def f(a, b):
    return max(len(str(a)), len(str(b)))


def main():
    input = sys.stdin.readline
    N = int(input())
    n = int(N**0.5)

    ans = 11
    for i in range(1, n+1):
        if N % i == 0:
            ans = min(ans, f(i, N//i))

    return ans


if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
N = int(input())
A = N
for i in range(2, int(pow(N, 0.5)) + 1):
    if N % i == 0:
        A = N / i
for j in range(1, N + 1):
    if A < 10 ** j:
        print(j)
        exit()

Submission status: Accepted

Solution code:
import math
N = int(input())
n = int(math.sqrt(N))
ans = float('inf')
for i in range(1,n+1):
  if(N%i == 0):
    a,b = i,N//i
    a,b = str(a),str(b)
    tmp = max(len(a),len(b))
    ans = min(ans,tmp)
print(ans)

Submission status: Accepted

Solution code:
import math
n=int(input())
a=math.floor(math.sqrt(n))

for i in range(1,a+1):
  if n%i==0:
    b=i

c=str(n/b)
print(len(c)-2)

Submission status: Accepted

Solution code:
import math

N = int(input())
n = math.ceil(math.sqrt(N))

a = 0
b = 0
for i in reversed(range(1, n+1)):
	if N%i==0:
		a = i
		b = N//i
		break

print(max(len(str(a)), len(str(b))))

Submission status: Accepted

Solution code:
import math
n = int(input())
pf_list = []

min_digit = float('inf')
for i in range(1, int(math.sqrt(n))+1):
  if n % i == 0:
    a = len(str(int(i)))
    b = len(str(int(n/i)))
    tmp_list = [a, b]
    tmp_list = list(map(int, tmp_list))
    if min_digit > max(tmp_list):
      min_digit = max(tmp_list)

print(min_digit)

Submission status: Accepted

Solution code:
import math
n = int(input())
ans = 1e10
for i in range(1, int(math.sqrt(n)) + 1) :
  if(n % i == 0) :
    ans = min(ans, int(math.log10(n/i)))
print(ans+1)

Submission status: Accepted

Solution code:
N = int(input())

for i in range(1,N+1):
    if i * i <= N:
        if N % i == 0:
            ans = i
    else:
        break
print(len(str(N // ans)))

Submission status: Accepted

Solution code:
N = int(input())
minimum = 10**9
num = []
for i in range(1, int(N**0.5)+1):
    if N%i == 0:
        num.append(i)
for i in num:
    A = i
    B = N//i
    minimum = len(str(max(A,B))) if minimum > len(str(max(A,B))) else minimum
print(minimum)

Submission status: Accepted

Solution code:
import numpy as np
 
n = int(input())
n_s = int(np.sqrt(n))
 
b = n
a = 1
 
for i in range(2, n_s+1):
  if n % i == 0:
    a = i
    b = n//i
 
print(int(max(np.log10(a), np.log10(b)))+1)

Submission status: Accepted

Solution code:
N=int(input())

import math
X=math.ceil(math.sqrt(N))

FACT=[]
for i in range(1,X+1):
    if N%i==0:
        FACT.append(i)

ANS=10**10

for f in FACT:
    x=N//f
    ANS=min(ANS,max(len(str(x)),len(str(f))))

print(ANS)

Submission status: Accepted

Solution code:
def getdigit(N):
  cnt = 0
  while(N>0):
    cnt += 1
    N //= 10
  return cnt

N = int(input())
for i in reversed(range(1,int(pow(N, 1/2))+1)):
  if(N % i == 0):
    print(max(getdigit(i), getdigit(N/i)))
    exit()

Submission status: Accepted

Solution code:
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
import math
#li=input().split()
#S=input()
#lis=list(map(int,input().split()))

n=int(input())

A=[0]
i=1
while i<=math.sqrt(n):
    if n%i==0:
        A.append(i)
    i+=1
B=[0]
s=[]
for i in range(len(A)-1):
    j=int(n/A[i+1])
    B.append(j)
    a=len(str(A[i+1]))
    b=len(str(B[i+1]))
    s.append(max(a,b))
ans=min(s)
print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
n = int(math.sqrt(N))
p = 1
while True:
  p = N//n
  if n*p == N:
    break
  else:
    n -= 1
print(max(len(str(n)),len(str(p))))

Submission status: Accepted

Solution code:
n=int(input());ans=10
for i in range(min(10**5,n)):
  if n%(i+1)==0:ans=min(ans,max(len(str(i+1)),len(str(n//(i+1)))))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
def divisor_all(n): # 約数全列挙
    import math as ma
    l = [1,n]
    for i in range(2,int(ma.sqrt(n))+1):
        if n % i == 0:
            l.append(i)
            l.append(n//i)
    l.sort()
    return l
ans = float('inf')
m = divisor_all(N)
for i in m:
    j = N // i
    ans = min(ans,max(len(str(i)),len(str(j))))
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 1e9
for i in range(1,int(n**0.5)+1):
  if n % i == 0:
    ans = min( ans, max( len(str(i)), len(str(n//i)) ) )
print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
M = int(math.sqrt(N))
for i in range(M):
    K = M - i
    if N % K == 0:
        L = N // K
        break
c = 0
while L > 0:
    L //= 10
    c += 1
print(c)

Submission status: Accepted

Solution code:
N = int(input())
sqN = N**0.5


def F(a, b):
    count = 0
    for i in range(10):
        a = a // 10
        b = b // 10
        count += 1
        if a <= 0 and b <= 0:
            break
    return count


minF = 10
for i in range(1, int(sqN)+1):
    if N % i == 0:
        f = F(i, N / i)
        minF = min(minF, f)

print(minF)

Submission status: Accepted

Solution code:
import math

N = int(input())
M = int(N**0.5//1)
S = list()
for i in range(M+1):
    if i > 0 :
       if N%i == 0:
           S.append(i)
a =  S[-1]
b = N//a
print(max(len(str(a)),len(str(b))))

Submission status: Accepted

Solution code:
import math

N = int(input())

min_l = len(str(N))

for i in range(1, int(math.sqrt(N)) + 1):
    if N % i == 0:
        j = int(N / i)
        min_l = min(min_l, max(len(str(i)), len(str(j))))
print(min_l)

Submission status: Accepted

Solution code:
import math
N = int(input())
root = math.sqrt(N) // 1
temp = 1
a = 1
while temp <= root:
    if N % temp == 0:
        a = temp
    temp += 1
print(len(str(N // a)))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

n = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

div = make_divisors(n)

ans = 10000000000

for i in range(len(div)):
    length = max(len(str(div[i])),len(str(int(n/div[i]))))
    ans = min(length,ans)

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=10
for i in range(1,10**5+1):
  if n%i==0 and n//i>=i:
    ans=min(ans,len(str(n//i)))
print(ans)

Submission status: Accepted

Solution code:
import math
N=int(input())

answer = 20

for a in range(1, math.floor(N**0.5+1)):
  if not N%a:
    answer = min(answer, math.floor(math.log10(N//a))+1)
print(answer)

Submission status: Accepted

Solution code:
N = int(input())
A = 1
answer = 10**10
while A**2 <= N:
    if N % A == 0:
        B = N//A
        if answer > max(len(str(A)), len(str(B))):
            answer = max(len(str(A)), len(str(B)))
    A += 1
print(answer)

Submission status: Accepted

Solution code:
import math
N = int(input())
ans = 12
for i in range(1, math.ceil(math.sqrt(N) + 1)):
    if N % i == 0:
        ans = min(ans, max(len(str(i)), len(str(N // i))))
print(ans)

Submission status: Accepted

Solution code:
from math import sqrt, ceil


def digit_num(n: int)->int:
    ret = 0
    while n > 0:
        ret += 1
        n //= 10
    return ret


def F(A: int, B: int)->int:
    return digit_num(max(A, B))


def digits_in_multiplication(N: int)->int:
    sq = ceil(sqrt(N))

    for n in range(sq, 0, -1):
        if N % n == 0:
            return F(N//n, n)
    return F(N, 1)


if __name__ == "__main__":
    N = int(input())
    ans = digits_in_multiplication(N)
    print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())

def keta(n):
    res = 1
    t = n // 10
    while t > 0:
        t //= 10
        res += 1
    return res

ans = 11
n = int(math.sqrt(N))
for i in range(n):
    a = i + 1
    if N % a == 0:
        b = N / a
    ans = min(ans, max(keta(a), keta(b)))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

divisor = []

for i in range(int(N ** 0.5)+1, 0, -1):
    if N % i == 0:
        divisor.append(i)
        break

B = N // divisor[0]
# print(B, divisor)
if len(str(divisor[0])) > len(str(B)):
    print(len(str(divisor[0])))
else:
    print(len(str(B)))

Submission status: Accepted

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
anslist = []
N = int(input())
for div in make_divisors(N):
  div2 = N//div
  anslist.append(max(len(str(div)),len(str(div2))))
print(min(anslist))

Submission status: Accepted

Solution code:
import math
N = int(input())
ans = len(str(N))
for i in range(1, int(math.sqrt(N)+1)):
    if N%i == 0:
        ans = len(str(N//i))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

import math
sqrtN = int(math.sqrt(N))

def F(a, b):
    return max(len(str(a)), len(str(b)))

best = 10*9
for n in range(1, sqrtN+1):
    q, mod = divmod(N, n)
    if n * q != N:
        continue
    v = F(n, q)
    if v < best:
        best = v

print(best)

Submission status: Accepted

Solution code:
import math

def count(a, b):
    a = len(str(a))
    b = len(str(b))

    return max(a, b)

N = int(input())
ans = 10**10

for a in range(1, math.ceil(math.sqrt(N))+1):
    if not N % a:
        b = N//a
        ans = min(ans, count(a, b))
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

min_digits = 100
for i in range(int(n ** 0.5) + 1):
    a = i + 1
    if n % a != 0:
        continue
    b = n // a
    x = max([a, b])
    digits = len(str(x))
    if digits < min_digits:
        min_digits = digits

print(min_digits)

Submission status: Accepted

Solution code:
N = int(input())
y = []
for i in range(1, int(N ** .5) + 1):
    if N % i == 0:
        y.append(i)
ans = float('inf')
for n in y:
    ans = min(ans, max(len(list(str(n))), len(list(str(N // n)))))
print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())

dvs = []
pair = []
digit = []

for i in range(1, int(N**0.5)+1):
  if N % i == 0:
    pair.append([i, N/i])
    
#for i in range(len(dvs)//2+1):
#  pair.append([dvs[i], dvs[-(i+1)]])

for i in range(len(pair)):
  digitA = int(math.log10(pair[i][0])) + 1
  digitB = int(math.log10(pair[i][1])) + 1
  digit.append(max(digitA, digitB))

ans = min(digit)
print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
max_div = math.ceil(math.sqrt(N))
ans = 10 ** 18

for i in range(1, max_div + 1):
    if N % i == 0:
        ans = min(ans, int(max((math.log10(N // i) + 1, math.log10(i) + 1))))

print(ans)

Submission status: Accepted

Solution code:
n=int(input())

x=int(n**0.5)

for i in range(x,0,-1):
    if n%i==0:
        a=str(i)
        b=str(n//i)
        print(max(len(a),len(b)))
        break

Submission status: Accepted

Solution code:
N = int(input())
ans = 10 ** 18
for i in range(10 ** 5, 0, -1):
     if N % i == 0:
#         print(i)
#         print(N // i)
        ans = min(max(len(str(N // i)),len(str(i))), ans)
print(ans)

Submission status: Accepted

Solution code:
import math
N=int(input())
for i in reversed(range(1,math.ceil(math.sqrt(N))+1)):
    if N%i==0:
        B=N//i
        print(math.floor(math.log10(B))+1)
        break

Submission status: Accepted

Solution code:
import math
n = int(input())
val = n
vals = []
for i in range(1, math.ceil(val**0.5) + 1):
    if val % i == 0:
        vals.append(i)
        
ans = float('inf')
for v in vals:
    ans = min(ans, max(len(str(v)), len(str(n // v))))
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

min_len = len(str(n))
for i in range(2,int(n**(1/2))+1):
    if n%i==0:
        l = max(len(str(i)), len(str(n//i)))
        min_len = min(min_len, l)


print(min_len)

Submission status: Accepted

Solution code:
from math import sqrt
n=int(input())
ans=[]
k=int(sqrt(n))
for i in range(1,k+1):
    if n%i==0:
        ans.append(len(str(int(n/i))))
ans.sort()
print(ans[0])

Submission status: Accepted

Solution code:
n=int(input())
def f(a,b):
  a=len(str(a))
  b=len(str(b))
  return max(a,b)

ans=10**9
for i in range(1,int(n**0.5)+1):
  if n%i==0:
    ans=min(ans,f(i,n//i))
print(ans)

Submission status: Accepted

Solution code:
import math
N=int(input())
ans=10**5
for i in range(1, int(math.sqrt(N))+1):
    if int(N/i) != N/i:
        continue
    else:
        j = int(N/i)
        ans = min(ans, max(len(str(i)), len(str(j))))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
import math as m
div = []

for i in range(1,int(m.sqrt(N))+1):
    if N % i == 0:
        div.append(i)

min = float("inf")
for i in div:
    if max(len(str(i)),len(str(N//i))) <= min:
        min = max(len(str(i)),len(str(N//i)))
print(min)

Submission status: Accepted

Solution code:
N = int(input())

def make_l(n):
    l = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            l.append(i)
            if i != n // i:
                l.append(n//i)
    return l

ans = 10**10
for a in make_l(N):
    ans = min(ans , max(len(str(a)) , len(str(int(N/a)))))
print(ans)

Submission status: Accepted

Solution code:

def func(A,B):
    return max(len(str(A)),len(str(B)))

def enum_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def main():
    N = int(input())
    divisors = enum_divisors(N)
    res = float('inf')
    for i in range(len(divisors)):
        A = divisors[i]
        B = int(N/A)
        if B < A:
            break
        res = min(res,func(A,B))

    print(res)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
F = []
for i in range(1,int(n**0.5)+1):
    if n%i == 0:
        F.append(max(len(str(i)),len(str(n//i))))
print(min(F))

Submission status: Accepted

Solution code:
n = int(input())

F = []
for i in range(1,int(n**0.5)+1):
    if n%i == 0:
        a,b = i,n//i
        if len(str(a)) >= len(str(b)):
            F.append(len(str(a)))
        else:
            F.append(len(str(b)))
print(min(F))

Submission status: Accepted

Solution code:
def ndigits(A):
    ret = 0
    while A > 0:
        ret += 1
        A //= 10
    return ret


def F(A, B):
    return max(ndigits(A), ndigits(B))


def main():
    N = int(input())
    x = 1
    ans = float("inf")
    while x*x <= N:
        if N % x == 0:
            ans = min(ans, F(x, N//x))
        x += 1
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
f=[10]*int(n**0.5)
for a in range(int(n**0.5)):
    b=n/(a+1)
    if b-int(b)==0:
        f[a]=max(len(str(a)), len(str(int(b))))
print(min(f))

Submission status: Accepted

Solution code:
N=int(input())
data=dict()
check=2
now=N
bef=1
while check<1+int(N**0.5):
    if now==1:break
    if now<=int(N**0.5):break
    if now%check==0:
        now//=check
        bef*=check
        if check in data:
            data[check]+=1
        elif check not in data:
            data[check]=1
    else:
        check+=1
if now!=1:
    if now not in data:
        data[now]=1
    elif now in data:
        data[now]+=1
if len(data)==0:
    print(len(str(N)))
else:
    A=1
    B=1
    
    while len(data)>0:
        big=max(data.keys())
        if B<A:
            A,B=B,A
        if len(str(B*big))==len(str(B)):
            B*=big
        else:
            A*=big
        data[big]-=1
        if data[big]==0:
            data.pop(big)
    print(len(str(max(A,B))))

Submission status: Accepted

Solution code:
n = int(input())

for i in range(1, int(n ** (1/2)+1)):
    if n % i == 0:
        t = n // i

print(len(str(t)))

Submission status: Accepted

Solution code:
n=int(input())
ans=9999
for i in range(1,int(n**(1/2))+1):
    if n%i==0:
        f=max(len(str(i)),len(str(n//i)))
        if f<ans:
            ans=f
print(ans)

Submission status: Accepted

Solution code:
N = input()

i = 1
ans = 99
while i*i<=N:
  if N%i==0:
    ans = min(ans, max(len(str(i)), len(str(N/i))))
  i += 1
print ans

Submission status: Accepted

Solution code:
import math

def F(A,B):
    checkA = len(str(A))
    checkB = len(str(B))
    return max(checkA, checkB)
    
N = int(input())
min = N**2

for i in range(1, int(math.sqrt(N))+1):
    if N % i == 0:
        tmp = F(i, int(N/i))
        if tmp < min:
            min = tmp

print(min)

Submission status: Accepted

Solution code:
def F(A, B):
  return max(len(str(A)), len(str(B)))

res = 10
N = input()
for i in range(1, 10**5):
  if N % i == 0:
    res = min(res, F(i, N / i))
print res

Submission status: Accepted

Solution code:
import math

N = int(input())

anss = []
for n in range(1,math.ceil(N**0.5)+1):
	if N % n == 0:
		anss.append(max(len(str(n)),len(str(N//n))))

if len(anss) == 0:
	anss.append(1)
		
print(min(anss))

Submission status: Accepted

Solution code:
N = int(input())
ans = N
for i in range(1,int(N**0.5)+1):
	if N%i == 0:
		a = len(str(int(N/i)))
	if a < ans:
		ans = a
print(ans)

Submission status: Accepted

Solution code:
#ABC057C
import math
N=int(input())
a=1
for n in range(1,int(N**(1/2))+1):
	if N%n==0:
		a=n
print(max(len(str(a)),len(str(N//a))))

Submission status: Accepted

Solution code:
import math
n = int(input())
m = int(math.sqrt(n))

for i in range(m+1,0,-1):
    if n % i == 0:
        a = i
        b = n//i
        break

print(max(len(str(a)),len(str(b))))

Submission status: Accepted

Solution code:
n = int(input())
l = [[i, n//i] for i in range(1, int(n**0.5)+1) if n % i == 0]
print(max(len(str(l[-1][0])), len(str(l[-1][1]))))

Submission status: Accepted

Solution code:
n = int(input())

max_a = int(pow(n, 1/2))

ans = 999
for a in range(1, max_a + 1):
    if n % a == 0:
        b = n // a
        temp = 1
        while b >= 10:
            b //= 10
            temp += 1
        ans = min(ans, temp)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 10000000

for A in range(1, int(N ** 0.5) + 1):
    if N % A == 0:
        B = int(N / A)
        keta = len(str(B))
        if keta < ans:
            ans = keta
print(ans)

Submission status: Accepted

Solution code:
import math

n=int(input())
l=len(str(n))
m=math.floor(n**0.5)
max=1
for i in range(1,m+1):
    if n%i==0:
        max=i
ans=len(str(n//max))
print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    print(solve(n))

def solve(n):
    i = 1
    m = 0
    while i * i <= n:
        if n % i == 0:
            m = i
        i += 1

    return intlog10(n // m)

def intlog10(n):
    return len(str(n))

main()

Submission status: Accepted

Solution code:
N=int(input())
a=1
for i in range(1,int(N**0.5)+1):
    if N%i==0:
        a=i

print(len(str(N//a)))

Submission status: Accepted

Solution code:
n=int(input())
a=1
for i in range(1,1+int(n**0.5)):
    if n%i==0:
        a=i
print(max(len(str(a)),len(str(n//a))))

Submission status: Accepted

Solution code:
N = int(input())
for i in range(1,1+int(N**(1/2))):
    if N % i == 0:
        tmp = i
print(max(len(str(N // tmp)),len(str(tmp))))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Tue Mar  5 17:48:45 2019

@author: yuta
"""
import math
N = int(input())

def main(n):
    sqrt_n = math.sqrt(n)
    min_keta = len(str(n))
    for i in range(1,int(sqrt_n)+1):
        if n % i == 0:
            j = int(n/i)
            max_num = max(i,j)
            c = len(str(max_num))
            if c < min_keta:
                min_keta = c
    print(min_keta)
main(N)

Submission status: Accepted

Solution code:
import math
n=int(input())
l=[]
for i in range(1,int(math.sqrt(n))+2):
    if n%i==0:
        l+=[max(len(str(i)),len(str(n//i)))]
print(min(l))

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
n = I()
ans = int(math.log10(n)+1)
for i in range(2,int(n**0.5)+1):
    if n%i == 0:
        ans = min(ans, max(int(math.log10(i)+1),int(math.log10(n//i)+1)))
print(ans)
#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Accepted

Solution code:
import math
n = int(input())
m = int(math.sqrt(n))
f = 10**10

for i in range(1,m+1):
    if n % i == 0:
        f = min(f, max(len(str(i)), len(str(n//i))))

print(f)

Submission status: Accepted

Solution code:
n = int(input())

ans = float('inf')
for i in range(1, int(n ** 0.5) + 1):
    if n % i == 0:
        x = max(len(str(i)), len(str(n // i)))
        ans = min(ans, x)
        
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
rootn = int((N**0.5) +1)
A = range(1, rootn)
min_digits = 11
for i in A:
    if (N % i) == 0:
        B = N // i
        p, q =len(str(i)), len(str(B))
        if (p > q) and (p < min_digits):
            min_digits = p
        elif (p <= q) and (q < min_digits):
            min_digits = q
print(min_digits)

Submission status: Accepted

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = inpl()	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

import math
import numpy as np
import copy
from collections import defaultdict, Counter
from itertools import product
from bisect import bisect_left, bisect_right
def inpl(): return list(map(int, input().split()))

def cnt_digits(N):
    digits = 1
    while N>=10:
        N /= 10
        digits += 1
    return digits

N = int(input())

ans = cnt_digits(N)

for A in range(1, int(math.sqrt(N))+1):
    if N % A != 0:
        continue
    B = N//A

    tmp = max(cnt_digits(A), cnt_digits(B))
    ans = min(ans, tmp)

print(ans)

Submission status: Accepted

Solution code:
def f(a, b):
    al = len(str(int(a)))
    bl = len(str(int(b)))
    if al > bl:
        return al
    return bl
N = int(input())
result = len(str(N))
for a in range(1, N):
    if a*a > N:
        break
    if (N % a) != 0:
        continue
    b = N / a
    r = f(a, b)
    if r < result:
        result = r
print (result)

Submission status: Accepted

Solution code:
def f(n):
    rootn = int((N**0.5)+1)
    A = range(1, rootn)
    min_output = 11
    for i in A:
        if (N % i) == 0:
            ilen = len(str(i))
            B = len(str(N//i))
            if ilen < B:
                if min_output > B:
                    min_output = B
            else:
                if min_output > ilen:
                    min_output = ilen
    return min_output
N = int(input())
print(f(N))

Submission status: Accepted

Solution code:
n = int(input())

def make_divisor_list(n):
  divisor_list = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisor_list.append(i)
      if i != n // i:
        divisor_list.append(n//i)
  divisor_list = sorted(divisor_list)
  return divisor_list
  
li = make_divisor_list(n)

if len(li)%2 ==1:
  print(len(str(li[len(li)//2])))
else:
  print(max(len(str(li[len(li)//2-1])),len(str(li[len(li)//2]))))

Submission status: Accepted

Solution code:
import math
ab = n = int(input())
sqrt = math.sqrt(n)
ans = 0
for i in range(int(sqrt)+1):
  if n % (i+1) == 0:
    ab = min(n/(i+1), ab)
while(ab > 0):
  ab = ab // 10
  ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def gk(n):
    ans = 0
    while n:
        ans += 1
        n //= 10
    return ans


ans = float("inf")
for i in range(1, int(N**(1/2))+1):
    if N % i == 0:
        ans = min(ans,gk( N//i)) 
print(ans)
exit(0)


lst = []
for i in range(2,int(N**(1/2))+1):
    if N % i == 0:
        ans = 0
        while N % i == 0:
            ans += 1
            N //= i
        lst.append( (i,ans) )

cand = [1]
while lst:
    p,cnt = lst.pop()
    nl = []
    # for p ==

Submission status: Accepted

Solution code:
N = int(input())
ans = 100
for A in range(1, int(N ** 0.5) + 1):
    if N % A != 0:
        continue
    F = max(len(str(A)), len(str(N // A)))
    ans = min(ans, F)
print(ans)

Submission status: Accepted

Solution code:
import math
n=int(input())
k = math.floor(math.sqrt(n))
for a in range(k+1,0,-1):
    if n % a == 0:
        print(max(len(str(a)),len(str(n//a))))
        break

Submission status: Accepted

Solution code:
import math
n = int(input())
k = math.floor(math.sqrt(n))
for i in range(k+1,0,-1):
    if n%i==0:
        print(max(len(str(n//i)),len(str(i))))
        break

Submission status: Accepted

Solution code:
N = int(input())
x = round(N**0.5)
while N%x != 0:
  x -= 1
print(len(str(N//x)))

Submission status: Accepted

Solution code:
N = int(input())

def prime_factor(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table

res = prime_factor(N)

result = 10 ** 10
for i in range(1, N+1):
    if N%i == 0:
        result = min(result, max(len(str(i)), len(str(N//i))))
    if i*i > N:
        break


print(result)

Submission status: Accepted

Solution code:
n = int(input())
divi = []
for i in range(1,round(n**(1/2)+2)):
    if n% i == 0:
        divi += [i]
print(len(str(n//max(divi))))

Submission status: Accepted

Solution code:
import math

N=int(input())
arr=[]
for i in range(math.ceil(math.sqrt(N))):
    #print(i)
    if N%(i+1)==0:
        #print(i+1)
        arr.append(max(math.log10(i+1),math.log10(N//(i+1))))
        #print(arr)
print(math.floor(min(arr))+1)