AtCoder Beginner Contest 057 - Digits in Multiplication

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-----
10000

-----Sample Output-----
3

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

Difficulty: EASY

Starter code:

Solutions:
N = int(input())
ans = 100000
for i in range(1, 10 ** 7):
	if N % i == 0:
		ans = min(ans, max(len(str(i)), len(str(N // i))))
print(ans)


from math import *

def func(x):
	ret_val = 0
	while 0 < x:
		x //= 10
		ret_val += 1
	return ret_val
N = int(input())
ans = func(N)
for A in range(1, int(sqrt(N)) + 1):
	if N % A == 0:
		B = N // A
		temp = max(func(A), func(B))
		ans = min(ans, temp)
print(ans)


import math
n = int(input())
max = 0
for a in range(1, int(n ** 0.5) + 2):
	if n % a == 0:
		max = a
print(int(math.log10(n / max) + 1))


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


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


n = int(input())
for i in range(int(n ** 0.5), 0, -1):
	if n % i == 0:
		break
print(len(str(n // i)))


import math
n = int(input())
nn = int(math.sqrt(n))
for i in range(nn, 0, -1):
	if n % i == 0:
		print(len(str(n // i)))
		break


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


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


import math
N = int(input())
ans = 10
for A in range(1, int(math.sqrt(N) + 1)):
	if N % A == 0:
		B = int(N / A)
		tmp = max(len(str(A)), len(str(B)))
		if ans > tmp:
			ans = tmp
print(ans)


def divisor(n):
	i = 1
	f = 0
	table = []
	while i * i <= n:
		if n % i == 0:
			f = max(len(str(i)), len(str(n // i)))
			table.append(f)
		i += 1
	return table
n = int(input())
print(min(divisor(n)))


import math
n = int(input())
s = 1
for i in range(int(math.sqrt(n)) + 1):
	if n % (i + 1) == 0:
		s = len(str(int(n / (i + 1))))
print(s)


n = int(input())
i = 0
l = []
while i ** 2 < n:
	i += 1
	if n % i == 0:
		l.append(max(len(str(i)), len(str(int(n / i)))))
print(min(l))


N = int(input())
for i in range(int(pow(N, 1 / 2)), 0, -1):
	if N % i == 0:
		print(max(len(str(i)), len(str(N // i))))
		break


n = int(input())
i = 1
while i * i <= n:
	if n % i == 0:
		ans = i
	i += 1
print(len(str(n // ans)))


import math
bb = int(input())
mini = bb
aa = int(math.sqrt(bb))
for i in range(1, aa + 1):
	if bb % i == 0:
		cc = int(bb / i)
		ans = len(str(cc))
		if ans < mini:
			mini = ans
print(mini)


def __starting_point():
	N = int(input())
	i = 1
	ans = 10
	while i * i <= N:
		if N % i == 0:
			f = max(len(str(i)), len(str(N // i)))
			ans = min(f, ans)
		i += 1
	print(ans)
__starting_point()


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


import math
from math import gcd, pi, sqrt
INF = float('inf')
import sys
sys.setrecursionlimit(10 ** 6)
import itertools
from collections import Counter, deque

def i_input():
	return int(input())

def i_map():
	return list(map(int, input().split()))

def i_list():
	return list(i_map())

def i_row(N):
	return [i_input() for _ in range(N)]

def i_row_list(N):
	return [i_list() for _ in range(N)]

def s_input():
	return input()

def s_map():
	return input().split()

def s_list():
	return list(s_map())

def s_row(N):
	return [s_input for _ in range(N)]

def s_row_str(N):
	return [s_list() for _ in range(N)]

def s_row_list(N):
	return [list(s_input()) for _ in range(N)]
import string

def main():
	N = i_input()
	l = []
	for i in range(1, math.ceil(sqrt(N)) + 1):
		if N % i == 0:
			l.append(i)
	ans = INF
	for i in l:
		b = N // i
		c = max(i, b)
		ans = min(ans, len(str(c)))
	print(ans)

def __starting_point():
	main()
__starting_point()


N = int(input())
for i in range(int(N ** (1 / 2)), 0, -1):
	if N % i == 0:
		print(len(str(N // i)))
		exit()


import math
N = int(input())
n = int(math.sqrt(N)) + 1
while N % n != 0:
	n -= 1
print(int(math.log10(N / n) + 1))


n = int(input())
mx = 1
for i in range(2, int(n ** (1 / 2)) + 1):
	if n % i == 0:
		mx = i
print(len(str(n // mx)))


N = int(input())
P = [i for i in range(1, int(N ** 0.5) + 1)][::-1]
for i in P:
	if N % i == 0:
		print(len(str(N // i)))
		break


def func(n):
	i = 1
	b = n
	while i * i <= n:
		if n % i == 0:
			if max(len(str(i)), len(str(n // i))) < b:
				b = max(len(str(i)), len(str(n // i)))
		i += 1
	return print(b)
n = int(input())
func(n)


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


N = int(input())
Fs = [len(str(N))]
for n in range(2, int(N ** (1 / 2)) + 1):
	if N % n == 0:
		num_digit = len(str(n)) if len(str(n)) >= len(str(N // n)) else len(str(N // n))
		Fs.append(num_digit)
print(min(Fs))


N = int(input())
M = int(N ** (1 / 2))
print(min([max([len(str(i)), len(str(int(N / i)))]) for i in range(1, M + 1) if N % i == 0]))


n = int(input())
m = int(n ** 0.5)
for i in range(m, 0, -1):
	if n % i == 0:
		a = i
		b = n // i
		break
print(len(str(max(a, b))))


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


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


N = int(input())
A = 1
ans = len(str(N))
while A ** 2 <= N:
	if N % A == 0:
		B = int(N / A)
		num = max(len(str(A)), len(str(B)))
		ans = min(ans, num)
	A += 1
print(ans)


n = int(input())

def cal(a):
	return len(str(a))
m = 11
for j in range(1, 10 ** 6 + 1):
	if n % j == 0:
		m = min(m, max(cal(j), cal(n // j)))
print(m)


n = int(input())
print(min((len(str(n // divisor)) for divisor in range(1, int(n ** 0.5) + 1) if n % divisor < 1)))


(n, r) = (int(input()), 1000000000.0)
for i in range(1, int(n ** 0.5) + 1):
	if n % i == 0:
		r = min(r, len(str(n // i)))
print(r)


n = int(input())
ans = 11
for i in range(int(n ** 0.5), 0, -1):
	if n % i == 0:
		ans = min([ans, len(str(n // i))])
print(ans)


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


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


from math import sqrt
from math import floor
n = int(input())
ans = 10 ** 10
for i in range(1, floor(sqrt(n)) + 1):
	if n % i == 0:
		a = str(i)
		b = str(n // i)
		ans = min(ans, max(len(a), len(b)))
print(ans)


n = int(input())
for i in range(int(n ** 0.5), 0, -1):
	if n % i == 0:
		print(max(len(str(i)), len(str(n // i))))
		exit()


def digit(a, b):
	a = str(a)
	b = str(b)
	return max(len(a), len(b))

def makedivisors(n):
	(lower_divisors, upper_divisors) = ([], [])
	i = 1
	while i * i <= n:
		if n % i == 0:
			lower_divisors.append(i)
			if i != n // i:
				upper_divisors.append(n // i)
		i += 1
	return lower_divisors + upper_divisors[::-1]
n = int(input())
l = makedivisors(n)
m = 10 ** 9
for a in range(len(l)):
	for b in range(len(l)):
		if l[a] * l[b] == n:
			m = min(m, digit(l[a], l[b]))
print(m)


import math
N = int(input())
sqN = math.floor(math.sqrt(N))
for i in range(sqN):
	if N % (i + 1) == 0:
		B = N // (i + 1)
		B = str(B)
		B = list(map(str, B))
		F = len(B)
print(F)


n = int(input())
div = [1]
for i in range(2, int(n ** 0.5) + 1):
	if n % i == 0:
		div.append(i)
m = div[-1]
if m == 1:
	print(len(str(n)))
else:
	print(max(len(str(n // m)), len(str(m))))


import math
N = int(input())
L = []
for i in range(1, math.floor(N ** 0.5) + 1):
	if N % i == 0:
		L.append([i, N // i])
ans = float('inf')
for i in range(len(L)):
	if L[i][0] > L[i][1]:
		ans = min(ans, len(str(L[i][0])))
	else:
		ans = min(ans, len(str(L[i][1])))
print(ans)


import math
N = int(input())
lim = math.floor(math.sqrt(N))
f_min = len(str(N))
for i in range(1, lim + 1):
	if N % i == 0:
		B = int(N / i)
		if len(str(B)) < f_min:
			f_min = len(str(B))
print(f_min)


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


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


N = int(input())
ans = 10
for A in range(1, int(N ** 0.5) + 1):
	if N / A == int(N / A):
		ans = min(ans, len(str(int(N / A))))
print(ans)


N = int(input())
i = 1
lst = []
while i * i <= N:
	if N % i == 0:
		lst.append(max(i, N // i))
	i += 1
ans = min(lst)
print(len(str(ans)))


import math
N = int(input())
root_N = int(math.sqrt(N))
for i in range(root_N, 0, -1):
	if N % i == 0:
		print(len(str(N // i)))
		break


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


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


import math
n = int(input())
a = int(math.sqrt(n))
while n % a != 0:
	a -= 1
print(len(str(n // a)))


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


import math
N = int(input())
n = int(math.sqrt(N))
for i in range(1, n + 1)[::-1]:
	if N % i == 0:
		print(int(math.log10(N / i)) + 1)
		break


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)


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


import math
n = int(input())
nn = int(math.sqrt(n))
while n % nn != 0:
	nn -= 1
ans = len(str(n // nn))
print(ans)


import math
import copy
import itertools
n = int(input())
flg = False
for i in range(int(math.sqrt(n)) + 1, 0, -1):
	if n % i == 0:
		a = i
		b = n // a
		flg = True
		break
if flg:
	print(max(len(str(a)), len(str(b))))
else:
	print(len(str(n)))


n = int(input())
res = 11
for a in range(1, int(n ** 0.5) + 1):
	if n % a == 0:
		b = n // a
		f = max(len(str(a)), len(str(b)))
		res = min(f, res)
print(res)


F = lambda *m: max((len(str(x)) for x in m))
N = int(input())
print(min((F(x, N // x) for x in range(1, int(N ** 0.5) + 1) if N % x == 0)))


N = int(input())
import math
for A in range(1, int(math.sqrt(N)) + 2):
	if N % A == 0:
		F = len(str(N // A))
print(F)


n = int(input())
c = 11
for i in range(1, int(n ** 0.5) + 2):
	if n % i == 0:
		c = min(c, len(str(n // i)))
print(c)


N = int(input())
f = lambda x, y: len(str(x)) if x > y else len(str(y))
from math import floor, sqrt
ans = len(str(N))
for a in range(1, floor(sqrt(N)) + 1):
	if N % a == 0:
		ans = min(ans, f(a, N // a))
print(ans)


import sys

def input():
	return sys.stdin.readline().strip()

def input_int():
	return int(input())

def input_int_list():
	return [int(i) for i in input().split()]

def make_divisors(n: int):
	lower_divs = []
	upper_divs = []
	i = 1
	while i ** 2 <= n:
		if n % i == 0:
			lower_divs.append(i)
			if i != n // i:
				upper_divs.append(n // i)
		i += 1
	return lower_divs + upper_divs[::-1]

def main():
	n = input_int()
	divs = make_divisors(n)
	ans = float('inf')
	for div in divs:
		a = div
		b = n // div
		if a * a <= n:
			ans = min(ans, max(len(str(a)), len(str(b))))
	print(ans)
	return

def __starting_point():
	main()
__starting_point()


num = int(input())
digits = len(str(num))
ans = digits
for i in range(1, 10 ** (digits // 2 + 1)):
	if num % i == 0:
		target = max(len(str(i)), len(str(num // i)))
		if ans >= target:
			ans = target
		else:
			print(ans)
			return
print(ans)


N = int(input())

def f(n):
	for i in range(int(n ** 0.5), 0, -1):
		if n % i == 0:
			return n // i
print(len(str(f(N))))


n = int(input())
root = int(n ** 0.5)
min_keta = 10000000000
for i in range(1, root + 1):
	if n % i == 0:
		one = len(str(i))
		two = len(str(n // i))
		min_keta = min(min_keta, max(one, two))
print(min_keta)


N = int(input())
for i in reversed(range(int(N ** 0.5) + 1)):
	if N % i == 0:
		print(len(str(max(i, N // i))))
		exit()


def cal(N):
	num = N ** 0.5 // 1
	num = int(num)
	for i in range(num, 0, -1):
		if N % i == 0:
			k = int(N / i)
			x = len(str(k))
			break
	return x
print(cal(int(input())))


n = int(input())

def make_divisors(n):
	(lower_divisors, upper_divisors) = ([], [])
	i = 1
	while i * i <= n:
		if n % i == 0:
			lower_divisors.append(i)
			if i != n // i:
				upper_divisors.append(n // i)
		i += 1
	return lower_divisors + upper_divisors[::-1]
yakusu = make_divisors(n)
l_yakusu = len(yakusu)
idx = 0
mx = 10
for a in range(1, 10 ** 5 + 1):
	if a > n:
		break
	if idx < l_yakusu and a == yakusu[idx]:
		idx += 1
		keta_a = len(str(a))
		keta_b = len(str(n // a))
		f = max(keta_a, keta_b)
		mx = min(mx, f)
print(mx)


N = int(input())
a = len(str(N))
i = 1
while i * i <= N:
	if N % i == 0:
		a = min(a, len(str(N // i)))
	i += 1
print(a)


import math
n = int(input())
x = 0
for i in range(1, int(math.sqrt(n)) + 1):
	if n % i == 0:
		x = i
b = n // x
print(len(list(str(b))))


n = int(input())
sq = int(n ** 0.5)
while n % sq != 0:
	sq -= 1
print(max(len(str(n // sq)), len(str(sq))))


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


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


N = int(input())
A = []
for i in range(int(N ** 0.5)):
	if N % (i + 1) == 0:
		A.append(i + 1)
print(len(str(int(N / A[-1]))))


n = int(input())
x = int(n ** 0.5)
while n % x != 0:
	x -= 1
print(max(len(str(x)), len(str(n // x))))


import math
n = int(input())
ans = 100
for a in range(1, int(math.sqrt(n)) + 1):
	if n % a == 0:
		m = max(len(str(a)), len(str(n // a)))
		ans = min(ans, m)
print(ans)


n = int(input())

def f(a, b):
	(a, b) = (len(str(a)), len(str(b)))
	return max(a, b)
flist = []
a = int(n ** 0.5)
for i in range(1, a + 1):
	if n % i == 0:
		j = int(n / i)
		tmp = f(i, j)
		flist.append(tmp)
print(min(flist))


import sys

def make_divisors(n):
	(lower_divisors, upper_divisors) = ([], [])
	i = 1
	while i * i <= n:
		if n % i == 0:
			lower_divisors.append(i)
			if i != n // i:
				upper_divisors.append(n // i)
		i += 1
	return lower_divisors + upper_divisors[::-1]
input = sys.stdin.readline
n = int(input())
yaku_list = make_divisors(n)
length = len(yaku_list)
half_index = int(length / 2)
a = 0
b = 0
if length % 2 == 0:
	a = yaku_list[half_index]
	b = yaku_list[half_index - 1]
else:
	a = yaku_list[half_index]
	b = a
keta_a = len(str(a))
keta_b = len(str(b))
print(max(keta_a, keta_b))


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))))


n = int(input())
i = 1
ans = float('inf')
while i ** 2 <= n:
	if n % i == 0:
		ans = min(ans, max(len(str(i)), len(str(n // i))))
	i += 1
print(ans)


n = int(input())
x = int(n ** 0.5)
for i in range(x):
	if n % (x - i) == 0:
		y = n // (x - i)
		y = str(y)
		print(len(y))
		break


import math
n = int(input())
a = 0
for i in range(1, int(math.sqrt(n)) + 1):
	if n % i == 0:
		a = i
b = n // a
j = 0
while True:
	m = b / 10 ** j
	if m >= 1 and m < 10:
		ans = j + 1
		break
	j += 1
print(ans)


import math
n = int(input())
d = 0
for i in range(1, int(math.sqrt(n)) + 1):
	if not n % i:
		d = n / i
print(len(str(int(d))))


from math import sqrt
n = int(input())
l = []
j = int(sqrt(n))
while True:
	if n % j == 0:
		break
	j -= 1
print(len(str(n // j)))


n = int(input())

def divs(n: int) -> list:
	divs = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			divs.append(i)
			if i != n // i:
				divs.append(n // i)
	divs.sort()
	return divs
div_l = divs(n)
print(max(len(str(div_l[len(div_l) // 2 - 1])), len(str(div_l[len(div_l) // 2]))))


import math
N = int(input())

def f(a, b):
	if len(str(a)) < len(str(b)):
		return len(str(b))
	else:
		return len(str(a))
ans = 100000000000
for i in range(1, int(math.sqrt(N) + 1)):
	if N % i == 0:
		ans = min(ans, f(i, N // i))
print(ans)


n = int(input())
a = 1
i = 2
while i * i <= n:
	if n % i == 0:
		a = i
	i += 1
b = n // a
print(len(str(b)))


import math

def f(a, b: int) -> int:
	alen = len(str(a))
	blen = len(str(b))
	if alen > blen:
		return alen
	else:
		return blen
n = int(input())
max = int(math.sqrt(n))
fmin = len(str(n))
for i in range(1, max + 1):
	if n % i == 0:
		tmp = f(i, int(n / i))
		if tmp < fmin:
			fmin = tmp
print(fmin)


N = int(input())
part = int(N ** 0.5)
while N % part != 0:
	part -= 1
Answer = max(len(str(part)), len(str(N // part)))
print(Answer)


import math
n = input()
answer = len(n)
number = int(n)
for a in range(int(math.sqrt(int(n))), 1, -1):
	if number % a != 0:
		continue
	b = number // a
	answer = min(answer, max(len(str(a)), len(str(b))))
	break
print(answer)


N = int(input())
M = 1
for i in range(1, int(N ** (1 / 2)) + 1):
	if N % i == 0:
		if M < i:
			M = i
M = N // M
ndm = len(list(str(M)))
print(ndm)


N = int(input())
n = int(N ** 0.5)
while N % n:
	n -= 1
print(len(str(N // n)))


n = int(input())
ans = []
for i in range(1, int(n ** 0.5) + 1):
	if (n / i).is_integer():
		a = len(str(i))
		b = len(str(int(n / i)))
		x = max(a, b)
		ans.append(x)
print(min(ans))


N = int(input())

def divisor(n):
	i = 1
	table = []
	while i * i <= n:
		if n % i == 0:
			table.append(n // i)
		i += 1
	num = min(table)
	ans = len(str(num))
	return ans
print(divisor(N))


N = int(input())
res = N
for i in range(1, int(N ** (1 / 2)) + 1):
	if N % i == 0:
		res = min(res, N // i)
print(len(str(res)))


import math
N = int(input())
n = math.floor(math.sqrt(N))
for i in range(n):
	if N % (n - i) == 0:
		print(len(str(N // (n - i))))
		exit()


n = int(input())
f = 11
for i in range(1, int(n ** (1 / 2)) + 1):
	if n % i == 0:
		f = min(f, len(str(n // i)))
print(f)


N = int(input())
import math
N_sqrt = int(math.sqrt(N))
A = [i for i in range(1, N_sqrt + 1) if N % i == 0]
print(len(str(N // A[-1])))


import sys
n = int(input())
a = int(n ** (1 / 2))
for i in range(a):
	if n % (a - i) == 0:
		print(len(str(n // (a - i))))
		sys.exit()


import math, sys
N = int(input())
for i in range(math.ceil(math.sqrt(N)), 0, -1):
	if N % i == 0:
		print(len(str(N // i)))
		sys.exit()


import sys
import pprint as pp

def II():
	return int(sys.stdin.readline())

def MI():
	return list(map(int, sys.stdin.readline().split()))

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]
MAXSIZE = (1 << 31) - 1
MINSIZE = -(1 << 31) + 1

def solver(input_int):
	result = len(str(input_int))
	for j in range(1, int(input_int ** 0.5) + 1, +1):
		divide_check = input_int % j != 0
		if divide_check:
			continue
		divide_value = input_int // j
		long_check = len(str(divide_value)) <= result
		if long_check:
			result = len(str(divide_value))
	return result

def __starting_point():
	N = II()
	print('{}'.format(solver(N)))
__starting_point()


n = int(input())
m = int(n ** 0.5)
while n % m:
	m -= 1
print(len(str(n // m)))


n = int(input())
nn = int(n ** (1 / 2))
while True:
	if n % nn == 0:
		break
	nn -= 1
print(len(str(n // nn)))


n = int(input())
ans = 1000
for i in range(1, 100001):
	if n % i == 0:
		ans = min(ans, len(str(max(n // i, i))))
print(ans)


n = int(input())
a = int(n ** 0.5)
while a > 0:
	if n % a == 0:
		print(len(str(n // a)))
		break
	a -= 1


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


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


import math
N = int(input())
A = []
B = []
num_list = []
root = math.floor(math.sqrt(N))

def solv(N):
	for i in range(1, root + 1):
		if N % i == 0:
			A.append(i)
			B.append(N // i)
	for (a, b) in zip(A, B):
		a_str = str(a)
		b_str = str(b)
		a_num = len(a_str)
		b_num = len(b_str)
		if a_num > b_num:
			num_list.append(a_num)
		elif a_num < b_num:
			num_list.append(b_num)
		else:
			num_list.append(a_num)
	return print(min(num_list))
solv(N)


url = 'https://atcoder.jp//contests/abc057/tasks/abc057_c'

def make_divisors(n):
	(lower_divisors, upper_divisors) = ([], [])
	i = 1
	while i * i <= n:
		if n % i == 0:
			lower_divisors.append(i)
			if i != n // i:
				upper_divisors.append(n // i)
		i += 1
	return lower_divisors + upper_divisors[::-1]

def main():
	n = int(input())
	ans = 10000000000000000
	ns = make_divisors(n)
	for i in range(0, len(ns) // 2 + 1):
		tmp = max(len(str(ns[i])), len(str(ns[len(ns) - i - 1])))
		ans = tmp if tmp < ans else ans
	if len(ns) % 2 != 0:
		tmp = len(str(ns[len(ns) // 2]))
		ans = tmp if tmp < ans else ans
	print(ans)

def __starting_point():
	main()
__starting_point()


def make_divisors(n):
	div = []
	for i in range(1, -int(-n ** 0.5 // 1)):
		if n % i == 0:
			div.append(i)
	if n % n ** 0.5 == 0:
		div.append(int(n ** 0.5))
	return div
n = int(input())
a = make_divisors(n)[-1]
b = n // a
print(len(str(b)))


from math import sqrt, log10
n = int(input())
for i in reversed(range(int(sqrt(n)) + 1)):
	if n % i == 0:
		break
a = int(log10(i)) + 1
b = int(log10(n // i)) + 1
print(max(a, b))


N = int(input())
F = [100000000000, 1]
for a in range(1, int(N ** 0.5) + 1):
	if N % a == 0:
		b = int(N / a)
		f = [a, b]
		if max(len(str(f[0])), len(str(f[1]))) < max(len(str(F[0])), len(str(F[1]))):
			F = f
print(max(len(str(F[0])), len(str(F[1]))))


N = int(input())
n = int(N ** (1 / 2) // 1)
for i in range(n):
	if i == n - 1:
		a = N
	elif N % (n - i) == 0:
		a = N // (n - i)
		break
print(len(str(a)))


import math
n = int(input())
f = []
for a in range(1, math.floor(n ** (1 / 2)) + 1):
	if n % a == 0:
		f.append(len(str(n // a)))
print(min(f))


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


def solve(num):
	s_num = str(num)
	return len(s_num)
n = int(input())
res = []
for i in range(1, int(n ** 0.5) + 1):
	if n % i == 0:
		x = n // i
		res.append(max(solve(x), solve(i)))
print(min(res))


import math
N = int(input())
tmp = math.floor(math.sqrt(N))
while N % tmp:
	tmp -= 1
print(len(str(N // tmp)))


import math
N = int(input())
B = int(math.sqrt(N))
while B > 0:
	if N % B == 0:
		break
	B -= 1
print(len(str(int(N / B))))


from math import sqrt
n = int(input())
ans = float('INF')
for i in range(1, int(sqrt(n)) + 1):
	if n % i == 0:
		j = n // i
		ans = min(ans, max(len(str(i)), len(str(j))))
print(ans)


n = int(input())
i = 1
ans = 10 ** 10
while i * i <= n:
	if n % i == 0:
		ans = min(ans, max(len(str(i)), len(str(n // i))))
	i += 1
print(ans)


n = int(input())
k = int(n ** (1 / 2))
ans = len(str(n))
for i in range(1, k + 1):
	if n % i == 0:
		ans = len(str(n // i))
print(ans)


import math
N = int(input())
n = int(math.sqrt(N))
while N % n != 0:
	n = n - 1
k = N / n
l = math.log(k, 10)
print(int(l) + 1)


from math import sqrt
n = int(input())
res = 100
for a in range(1, int(sqrt(n)) + 1):
	if n % a == 0:
		b = n // a
		res = min(res, max(len(str(a)), len(str(b))))
print(res)


n = int(input())
print(min([max(len(str(n // x)), len(str(x))) for x in range(1, int(n ** 0.5) + 1) if n % x == 0]))


n = int(input())

def f(a, b):
	a = list(str(a))
	b = list(str(b))
	return max(len(a), len(b))
m = float('inf')
for i in range(1, int(n ** 0.5) + 1):
	if n % i == 0:
		m = min(m, f(i, n // i))
print(m)


N = int(input())
x = []
for i in range(1, int((N + 1) ** 0.5) + 1):
	if N % i == 0:
		x.append(i)
y = int(N / x[-1])
print(len(str(y)))


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


N = int(input())
mi = 1 << 100
for i in range(1, int(N ** 0.5) + 10):
	if N % i == 0:
		mi = min(mi, len(str(max(i, N // i))))
print(mi)


N = int(input())
i = int(pow(N, 1 / 2))
while N % i > 0:
	i -= 1
print(len(str(N // i)))


N = int(input())
i = 1
ans = 1000000000000
while i * i <= N:
	if N % i == 0:
		x = i
		y = N // i
		ans = min(ans, max(len(str(x)), len(str(y))))
	i += 1
print(ans)


import math
n = int(input())
s = math.ceil(math.sqrt(n))
h = 10 ** 5
for i in range(1, s + 1):
	if n % i == 0:
		if h > max(len(str(i)), len(str(int(n / i)))):
			h = max(len(str(i)), len(str(int(n / i))))
print(h)


n = int(input())
i = int(n ** 0.5)
while i:
	if n % i == 0:
		print(max(len(str(i)), len(str(n // i))))
		break
	i -= 1


n = int(input())
for x in range(int(n ** 0.5), 0, -1):
	if n % x == 0:
		print(len(str(n // x)))
		exit()


n = int(input())

def solve(n):
	i = 1
	ans = 10000000
	while i * i <= n:
		if n % i == 0:
			lower = i
			if i != n // i:
				upper = n // i
			else:
				upper = i
			anstmp = max(len(str(lower)), len(str(upper)))
			if ans > anstmp:
				ans = anstmp
		i += 1
	return ans
print(solve(n))


N = int(input())
high_divs = []
k = 1
while k * k <= N:
	if N % k == 0:
		high_divs.insert(0, N // k)
	k += 1
print(len(str(high_divs[0])))


import math
n = int(input())
for a in range(1, int(math.sqrt(n)) + 1):
	if n % a == 0:
		b = n // a
		ans = len(str(b))
print(ans)


n = int(input())
ans = n
for q in range(1, int(n ** 0.5) + 1):
	if not n % q:
		ans = min(ans, len(str(n // q)))
print(ans)


n = int(input())
for i in reversed(range(1, int(n ** (1 / 2)) + 1)):
	if n % i == 0:
		print(len(str(n // i)))
		break


import math

def main():
	N = int(input())
	keta = int(math.log10(N)) + 1
	for A in range(1, int(pow(N, 0.5)) + 1):
		if N % A == 0:
			B = N // A
			keta = min(keta, int(math.log10(B)) + 1)
	print(keta)
main()


def divisor(n):
	l = []
	ll = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			l.append(i)
	return l
n = int(input())
l = divisor(n)
ans = 100100100100
for i in l:
	a = len(str(i))
	b = len(str(n // i))
	ans = min(ans, max(a, b))
print(ans)


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


N = int(input())
ans = 11
i = 1
while i ** 2 <= N:
	if N % i == 0:
		ans = min(ans, len(str(N // i)))
	i += 1
print(ans)


N = int(input())
B = N
for i in range(1, N + 1):
	j = N // i
	if i > j:
		break
	if N % i == 0:
		B = j
print(len(str(B)))


import math
n = int(input())
a = math.floor(n ** 0.5)
while a > 1:
	if n % a == 0:
		break
	a -= 1
print(max(len(str(a)), len(str(n // a))))


N = int(input())

def divisors(N):
	result = 1000000000000.0
	for i in range(2, N):
		if i ** 2 > N:
			break
		if N % i == 0:
			B = int(N / i)
			tmp = max(len(str(B)), len(str(i)))
			result = min(result, tmp)
	if result == 1000000000000.0:
		result = len(str(N))
	return result
print(divisors(N))


import math
n = int(input())

def k(p):
	c = 0
	while p > 0:
		c += 1
		p //= 10
	return c
res = 100
for i in range(1, int(math.sqrt(n)) + 5):
	if n % i == 0:
		res = min(max(k(i), k(n // i)), res)
print(res)


N = int(input())
M = int(pow(N, 1 / 2))
for i in range(M, 0, -1):
	if N % i == 0:
		print(len(str(N // i)))
		return


import math
n = int(input())

def f(a, b):
	if len(str(a)) < len(str(b)):
		return len(str(b))
	else:
		return len(str(a))
ans = float('inf')
for i in range(1, int(math.sqrt(n) + 1)):
	if n % i == 0:
		ans = min(ans, f(i, n // i))
print(ans)


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


n = int(input())
ans = 10 ** 5
x = int(n ** 0.5)
for i in range(x, 0, -1):
	if n % i == 0:
		y = n // i
		ans = min(ans, len(str(y)))
print(ans)


def get_divisors(n):
	(lower_divisors, upper_divisors) = ([], [])
	i = 1
	while i * i <= n:
		if n % i == 0:
			lower_divisors.append(i)
			upper_divisors.append(n // i)
		i += 1
	return [lower_divisors, upper_divisors]
n = int(input())
up = get_divisors(n)[0]
dn = get_divisors(n)[1]
ans = 11
for (a, b) in zip(up, dn):
	a = str(a)
	b = str(b)
	f = max(len(a), len(b))
	ans = min(ans, f)
print(ans)


import sys
import math

def f(x: int, y: int) -> int:
	return max(len(str(x)), len(str(y)))
n = int(input())
min_f_value = sys.maxsize
for a in range(1, int(math.sqrt(n)) + 1):
	(b, rem) = divmod(n, a)
	if rem == 0:
		min_f_value = min(min_f_value, f(a, b))
print(min_f_value)


N = int(input())
result = 0
count = 1
while count * count <= N:
	if N % count == 0:
		result = count
	count += 1
print(len(str(N // result)))


n = int(input())

def f(a, b):
	return max(len(str(a)), len(str(b)))
m = 10000
for a in range(1, 10 ** 10):
	if n % a == 0:
		m = min(f(a, n // a), m)
	if n < a or n // a < a:
		break
print(m)


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


import math
n = int(input())
i = int(math.sqrt(n))
while i > 0:
	if n % i == 0:
		print(len(str(int(n / i))))
		break
	i -= 1


n = int(input())
a = int(n ** 0.5)
while n % a != 0:
	a -= 1
b = n // a
print(len(str(max(a, b))))


import math
N = int(input())
rootN = int(math.sqrt(N))
while N % rootN != 0:
	rootN -= 1
print(len(str(N // rootN)))


N = int(input())
x = int(N ** (1 / 2))
while N % x != 0:
	x -= 1
print(len(str(N // x)))


N = int(input())
M = round(N ** 0.5) + 1
for i in range(M, 0, -1):
	if N % i == 0:
		ans = len(str(N // i))
		break
print(ans)


import math

def ten(p):
	if p == 0:
		return 0
	else:
		return ten(p // 10) + 1
N = int(input())
x = int(math.sqrt(N))
while N % x != 0:
	x -= 1
y = int(N / x)
print(ten(y))


N = int(input())
ans = float('inf')
for i in range(1, int(N ** (1 / 2) // 1) + 1):
	if N % i == 0:
		ans = min(ans, len(str(N // i)))
print(ans)


N = int(input())
result = []
for i in range(1, int(N ** (1 / 2)) + 1):
	if N % i == 0:
		result.append(len(str(int(N / i))))
print(min(result))


N = int(input())
x = int(pow(N, 0.5))
while N % x != 0:
	x -= 1
print(len(str(N // x)))


n = int(input())

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

def make_divisors(n):
	(lower_divisors, upper_divisors) = ([], [])
	i = 1
	while i * i <= n:
		if n % i == 0:
			lower_divisors.append(i)
			if i != n // i:
				upper_divisors.append(n // i)
		i += 1
	return lower_divisors + upper_divisors[::-1]
l = make_divisors(n)
if len(l) % 2 == 0:
	m = float('inf')
	for i in range(len(l) // 2):
		m = min(m, f(l[i], n // l[i]))
	print(m)
else:
	m = float('inf')
	for i in range(len(l) // 2 + 1):
		m = min(m, f(l[i], n // l[i]))
	print(m)


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

def __starting_point():
	main()
__starting_point()


n = int(input())
i = round(n ** 0.5)
while n % i != 0:
	i -= 1
print(len(str(n // i)))


import math
N = int(input())
r = []
for i in range(1, math.floor(N ** 0.5) + 1):
	if N % i == 0:
		r.append(i)
print(len(str(N // r[-1])))


N = int(input())
ans = len(str(N))
for a in range(2, int(N ** 0.5) + 1):
	if N % a == 0:
		b = N // a
		ans = min(ans, len(str(b)))
print(ans)


N = int(input())
m = int(N ** 0.5)
while True:
	if N % m == 0:
		print(len(str(N // m)))
		exit()
	else:
		m -= 1