AtCoder Beginner Contest 152 - Comparing Strings

Given are 1-digit positive integers a and b. Consider these two strings: the concatenation of b copies of the digit a, and the concatenation of a copies of the digit b. Which of these is lexicographically smaller?

-----Constraints-----
 - 1 \leq a \leq 9
 - 1 \leq b \leq 9
 - a and b are integers.

-----Input-----
Input is given from Standard Input in the following format:
a b

-----Output-----
Print the lexicographically smaller of the two strings. (If the two strings are equal, print one of them.)

-----Sample Input-----
4 3

-----Sample Output-----
3333

We have two strings 444 and 3333. Between them, 3333 is the lexicographically smaller.

Difficulty: EASY

Starter code:

Solutions:
(a, b) = map(int, input().split())
A = [str(a) * b, str(b) * a]
print(sorted(A)[0])


(a, b) = map(int, input().split())
print(str(min(a, b)) * max(a, b))


(a, b) = map(int, input().split())
x = sorted([str(a) * b, str(b) * a])
print(x[0])


(N, M) = input().split()
print(N * int(M) if N * int(M) < M * int(N) else M * int(N))


(a, b) = map(str, input().split())
aa = a * int(b)
bb = b * int(a)
print(min(aa, bb))


(a, b) = input().split()
li = [a * int(b), b * int(a)]
li.sort()
print(li[0])


(a, b) = map(int, input().split())
print(*[min(a, b)] * max(a, b), sep='')


(a, b) = map(int, input().split())
sa = str(a) * b
sb = str(b) * a
print(min(sa, sb))


(N, M) = input().split()
print(min(N * int(M), M * int(N)))


(a, b) = map(int, input().split())
list = []
if a > b:
	for i in range(a):
		list.append(b)
else:
	for j in range(b):
		list.append(a)
list = [str(a) for a in list]
list = ''.join(list)
print(list)


(a, b) = input().split()
str_a = a * int(b)
str_b = b * int(a)
print(str_a if str_a < str_b else str_b)


(a, b) = list(map(int, input().split()))
A = str(a)
B = str(b)
aaa = A * b
bbb = B * a
lists = sorted([aaa, bbb])
print(lists[0])


(a, b) = [int(j) for j in input().split()]
print(min(str(a) * b, str(b) * a))


(a, b) = map(int, input().split())
if a > b:
	print(int(str(b) * a))
else:
	print(int(str(a) * b))


(a, b) = map(int, input().split())
f = str(a) * b
n = str(b) * a
if f > n:
	print(n)
else:
	print(f)


(a, b) = input().split()
print(b * int(a)) if b <= a else print(a * int(b))


(a, b) = input().split()
A = [a * int(b), b * int(a)]
print(sorted(A)[0])


(a, b) = map(str, input().split())
d = [a * int(b), b * int(a)]
d.sort()
print(d[0])


(a, b) = input().split()
s = a * int(b)
t = b * int(a)
l = [s, t]
l.sort()
print(l[0])


(a, b) = input().split()
print(min(b * int(a), a * int(b)))


(N, M) = input().split()
L = [N, M]
L = sorted(L)
print(L[0] * int(L[1]))


A = list(map(int, input().split()))
print(str(min(A)) * max(A))


(N, M) = map(int, input().split(' '))
print(str(min(N, M)) * max(N, M))


n = 2
a = [0] * n
a[:] = map(int, input().split())
a.sort()
print(str(a[0]) * a[1])


(n, m) = map(int, input().split())
if n > m:
	(n, m) = (m, n)
print(str(n) * m)


(a, b) = list(map(int, input().split()))
c = 0
if a >= b:
	for i in range(a):
		c = c * 10 + 1
	print(b * c)
else:
	for i in range(b):
		c = c * 10 + 1
	print(a * c)


(a, b) = input().split()
a0 = int(a)
b0 = int(b)
print(min(a * b0, b * a0))


(a, b) = sorted(list(map(int, input().split())))
print(str(a) * b)


(x, y) = input().split()
print(min(x * int(y), y * int(x)))


(a, b) = input().split()
ans = a * int(b)
ans2 = b * int(a)
print(min(ans, ans2))


(a, b) = map(int, input().split())
L = [str(a) * b, str(b) * a]
L = sorted(L)
print(L[0])


(n, m) = list(map(int, input().split()))
if n > m:
	(n, m) = (m, n)
res = str(n)
print(res * m)


(a, s) = input().split()
(f, g) = (a * int(s), s * int(a))
print(sorted([f, g])[0])


(A, B) = map(int, input().split())
answer = str(min(A, B)) * max(A, B)
print(answer)


(a, b) = map(int, input().split())
A = str(a) * b
B = str(b) * a
print(A if A <= B else B)


(a, b) = map(int, input().split())
s = [a, b]
s.sort()
print(str(s[0]) * s[1])


(a, b) = sorted(input().split())
print(a * int(b))


(n, m) = map(int, input().split())
print(min(str(n) * m, str(m) * n))


(a, b) = input().split()
lst = [a * int(b), b * int(a)]
lst.sort()
print(lst[0])


(a, b) = sorted(input())[1:]
print(a * int(b))


(a, b) = map(int, input().split())
if a <= b:
	ans = str(a) * b
else:
	ans = str(b) * a
print(ans)
return


ab = list(map(int, input().split()))
print(str(min(ab)) * max(ab))


x = input().split()
n = x[0]
m = x[1]
print(min(n * int(m), m * int(n)))


ls = list(map(int, input().split()))
print(str(min(ls)) * max(ls))


(A, B) = input().split()
S = [A * int(B), B * int(A)]
ans = sorted(S)
print(ans[0])


(a, b) = map(int, input().split())
minValue = min(a, b)
maxValue = max(a, b)
print(str(minValue) * maxValue)


(a, b) = sorted([int(_) for _ in input().split()])
print(str(a) * b)


(_, a, b) = sorted(input())
print(a * int(b))


(A, B) = map(int, input().split())
print(min(str(A) * B, str(B) * A))


N = list(map(int, input().split()))
print(str(min(N)) * max(N))


(a, b) = map(str, input().split())
c = a * int(b)
d = b * int(a)
print(min(c, d))


(a, b) = input().split()
sa = a * int(b)
sb = b * int(a)
print(min(sa, sb))


ab = input().split(' ')
print(min(ab[0] * int(ab[1]), ab[1] * int(ab[0])))


(n, m) = input().split()
s1 = n * int(m)
s2 = m * int(n)
print(min(s1, s2))


(a, b) = [s for s in input().split()]
print(min(a * int(b), b * int(a)))


(a, b) = map(str, input().split())
A = a * int(b)
B = b * int(a)
print(min(A, B))


(a, b) = map(int, input().split())
s = str(min(a, b))
m = max(a, b)
print(s * m)


(a, b) = input().split()
x = a * int(b)
y = b * int(a)
print(min(x, y))


(a, b) = map(int, input().split())
t = str(a) * b
tt = str(b) * a
print(min(t, tt))


(a, b) = input().split()
print(max(int(a * int(b)), int(b * int(a))))


(a, b) = map(int, input().split())
lists = []
lists.append(str(a) * b)
lists.append(str(b) * a)
lists.sort()
print(lists[0])


(a, b) = input().split()
ab = a * int(b)
ba = b * int(a)
print(ab if ab < ba else ba)


(a, b) = input().split()
l = [a * int(b), b * int(a)]
l.sort()
print(l[0])


f = list(map(int, input().split()))
print(str(min(f)) * max(f))


L = list(map(int, input().split()))
print(str(min(L)) * max(L))


(a, b) = input().split()
l = [a * int(b), b * int(a)]
print(sorted(l)[0])


(a, b) = input().split()
x = sorted([a * int(b), b * int(a)])
print(x[0])


(a, b) = map(int, input().split())
p = min(a, b)
q = max(a, b)
print(str(p) * q)


(a, b) = map(int, input().split())
str1 = str(a) * b
str2 = str(b) * a
print(min(str1, str2))


a = list(map(int, input().split()))
a.sort()
print(str(a[0]) * a[1])


(a, b) = input().split()
s = a * int(b)
t = b * int(a)
print(min(s, t))


(a, b) = list(map(int, input().split()))
c = str(a) * b
d = str(b) * a
if c > d:
	print(d)
else:
	print(c)


(S, T) = map(int, input().split())
print(str(S) * T if S <= T else str(T) * S)


(a, b) = input().split()
A = a * int(b)
B = b * int(a)
print(min(A, B))


def answer(a: int, b: int) -> str:
	return min(str(a) * b, str(b) * a)

def main():
	(a, b) = map(int, input().split())
	print(answer(a, b))

def __starting_point():
	main()
__starting_point()


(a, b) = map(int, input().split())
if a <= b:
	ans = a
	for i in range(b - 1):
		ans = ans * 10 + a
else:
	ans = b
	for i in range(a - 1):
		ans = ans * 10 + b
print(ans)


(a, b) = map(int, input().split())
s = str(a) * b
p = str(b) * a
print(min(s, p))


(a, b) = map(int, input().split())
a1 = a * str(b)
a2 = b * str(a)
print(min(a1, a2))


(a, b) = input().split()
r = sorted([a * int(b), b * int(a)])
print(r[0])


(a, b) = list(map(int, input().split()))
print(min(str(a) * b, str(b) * a))


(a, b) = sorted(input().split())
print(''.join((a for i in range(int(b)))))


(a, b) = map(int, input().split())
C = min(a, b)
D = max(a, b)
print(str(C) * D)


(n, m) = map(int, input().split())
l = [str(n) * m, str(m) * n]
l.sort()
print(l[0])


(a, b) = input().split()
c = a * int(b)
d = b * int(a)
print(min(c, d))


(O, K) = input().split()
I = O * int(K)
U = K * int(O)
print(sorted([I, U])[0])


l = list(map(int, input().split()))
l.sort()
print(str(l[0]) * l[1])


l = sorted(map(int, input().split()))
print(str(l[0]) * l[1])


(a, b) = map(int, input().split())
(x, y) = (a, b) if a <= b else (b, a)
for _ in range(y):
	print(x, end='')


(x, y) = map(int, input().split())
print(str(min(x, y)) * max(x, y))


(a, b) = sorted(map(int, input().split()))
c = str(a)
print(c * b)


(a, b) = input().split()
x = a * int(b)
y = b * int(a)
l = [x, y]
l.sort()
print(l[0])


a = sorted(input().split())
print(a[0] * int(a[1]))


(a, b) = input().split()
c = [a * int(b), b * int(a)]
print(sorted(c)[0])


(a, b) = list(map(int, input().split()))
lists = [str(a) * b, str(b) * a]
sort_list = sorted(lists)
print(sort_list[0])


L = sorted(list(map(str, input().split())))
print(L[0] * int(L[1]))


(a, b) = input().split()
X = a * int(b)
Y = b * int(a)
print(min(X, Y))


(a, b) = map(int, input().split())
aa = str(a) * b
bb = str(b) * a
aa = ''.join(aa)
bb = ''.join(bb)
if aa > bb:
	print(bb)
else:
	print(aa)


l = list(map(int, input().split()))
print(str(min(l)) * max(l))


(a, b) = input().split()
aa = [a * int(b), b * int(a)]
aa.sort()
print(aa[0])


(a, b) = input().split()
a2 = a * int(b)
b2 = b * int(a)
print(min(a2, b2))


(N, M) = map(int, input().split())
print((str(N) * M, str(M) * N)[N > M])


(x, y) = list(map(int, input().split()))
if x > y:
	print(str(y) * x)
else:
	print(str(x) * y)


li = input().split()
li.sort()
print(li[0] * int(li[1]))


(n, m) = input().split()
print(min(n * int(m), m * int(n)))


(a, b) = map(int, input().split())
ab = str(a) * b
ba = str(b) * a
if ab > ba:
	ans = ba
else:
	ans = ab
print(ans)


from sys import setrecursionlimit, exit
setrecursionlimit(1000000000)

def main():
	(a, b) = map(int, input().split())
	if a <= b:
		print(str(a) * b)
	else:
		print(str(b) * a)
main()


(a, b) = map(int, input().split())
a_str = str(a)
b_str = str(b)
ab_list = sorted([a_str * b, b_str * a])
print(ab_list[0])


def main():
	(a, b) = list(map(int, input().split()))
	f = str(a) * b
	s = str(b) * a
	ans = [f, s]
	ans.sort()
	return ans[0]

def __starting_point():
	print(main())
__starting_point()


(a, b) = map(int, input().split())
ans = ''
if a <= b:
	for i in range(b):
		ans += str(a)
elif b < a:
	for i in range(a):
		ans += str(b)
print(ans)


def main():
	(a, b) = list(map(int, input().split()))
	can_a = str(a) * b
	can_b = str(b) * a
	if can_a < can_b:
		print(can_a)
	else:
		print(can_b)

def __starting_point():
	main()
__starting_point()


(a, b) = input().split()
A = a * int(b)
B = b * int(a)
print(A if A < B else B)


(a, b) = input().split()
x = [b * int(a), a * int(b)]
x.sort()
print(x[0])


(a, b) = map(str, input().split())
m = a * int(b)
p = b * int(a)
print(min(m, p))


(a, b) = map(int, input().split())
l = sorted([str(a) * b, str(b) * a])
print(l[0])


(a, b) = map(int, input().split())

def dic():
	(a_str, b_str) = (str(a), str(b))
	a_moji = a_str * b
	b_moji = b_str * a
	dic = {a_moji: 1, b_moji: 2}
	dic = sorted(dic.items())
	return dic[0][0]
print(dic())


n = [int(i) for i in input().split()]
print(str(min(n)) * max(n))


N = list(map(int, input().split()))
N.sort()
print(str(N[0]) * N[1])


(x, y) = input().split()
a = x * int(y)
b = y * int(x)
c = [a, b]
c.sort()
print(c[0])


(a, b) = map(int, input().split())
a_b = str(a) * b
b_a = str(b) * a
if int(a_b[0]) >= int(b_a[0]):
	print(b_a)
else:
	print(a_b)


(a, b) = input().split()
na = a * int(b)
nb = b * int(a)
print(min(na, nb))


a = input()
a = a.split()
b = a[1]
a = a[0]
if a < b:
	d = a
	for c in range(int(b) - 1):
		d = d + a
else:
	d = b
	for c in range(int(a) - 1):
		d = d + b
print(int(d))


a = sorted(list(map(int, input().split())))
print(str(a[0]) * a[1])


(a, b) = map(str, input().split())
list = []

def Repetition(x: str, y: str):
	list.append(x * int(y))
	return
Repetition(a, b)
Repetition(b, a)
list.sort()
print(list[0])


vals = list(map(int, input().split()))
(min_val, max_val) = sorted(vals)
ret = ''
for i in range(max_val):
	ret += str(min_val)
print(ret)


ab = input().split()
ab.sort()
print(ab[0] * int(ab[1]))


a = input().split()
print(min(a) * int(max(a)))


line = list(input().split())
line.sort()
print(line[0] * int(line[1]))


(a, b) = list(map(int, input().split()))
my_list = []
if a > b:
	for i in range(a):
		my_list.append(b)
elif b > a:
	for i in range(b):
		my_list.append(a)
else:
	for i in range(a):
		my_list.append(b)
print(''.join([str(n) for n in my_list]))


import numpy as np
(a, b) = map(int, input().split())
A = ''.join([str(a)] * b)
B = ''.join([str(b)] * a)
print(min(A, B))


(A, B) = list(map(int, input().split()))
ans = [str(A) * B, str(B) * A]
ans.sort()
print(ans[0])


(A, B) = input().split()
print(min(A * int(B), B * int(A)))


(a, b) = input().split()
a1 = a * int(b)
b1 = b * int(a)
if int(a) <= int(b):
	print(a1)
else:
	print(b1)


(a, b) = map(int, input().split())
x = str(a) * b
y = str(b) * a
print(min(x, y))


(a, b) = input().split()
ans = sorted([a * int(b), b * int(a)])
print(ans[0])


input_line = input().rstrip().split()
num1 = int(input_line[0])
num2 = int(input_line[1])
if num1 > num2:
	print(str(num2) * num1)
elif num1 < num2:
	print(str(num1) * num2)
elif num1 == num2:
	print(str(num1) * num2)


(A, B) = input().split()
if A <= B:
	print(A * int(B))
else:
	print(B * int(A))


(a, b) = map(str, input().split())
A = a * int(b)
B = b * int(a)
x = [A, B]
x.sort()
print(x[0])


(a, b) = input().split()
ab = a * int(b)
ba = b * int(a)
s = max(len(ab), len(ba))
if s == len(ab):
	print(ab)
else:
	print(ba)


(a, b) = map(int, input().split())

def ans152(a: int, b: int):
	listab = [str(a) * b, str(b) * a]
	listab.sort()
	return int(listab[0])
print(ans152(a, b))


(a, b) = map(int, input().split())
print((f'{a}' * b, f'{b}' * a)[b <= a])


(a, b) = list(map(int, input().split()))
if a < b:
	print(str(a) * b)
elif a > b:
	print(str(b) * a)
elif a == b:
	print(str(a) * b)


(a, b) = sorted(list(map(int, input().split())))
print(a * (10 ** b - 1) // 9)


(A, B) = input().split()
i = A * int(B)
u = B * int(A)
print(sorted([i, u])[0])


(a, b) = map(int, input().split())
r = min(a, b)
n = max(a, b)
print(str(r) * n)


(a, b) = map(int, input().split())
A = 0
B = 0
for i in range(a):
	A += b * 10 ** i
for i in range(b):
	B += a * 10 ** i
if a > b:
	print(A)
else:
	print(B)


ab = list(map(int, input().split()))
ab.sort()
print(str(ab[0]) * ab[1])


(a, b) = input().split()
ans = [a * int(b), b * int(a)]
ans.sort()
print(ans[0])


x = sorted(input().split())
print(x[0] * int(x[1]))


(a, b) = map(int, input().split())
x = [str(a) * b, str(b) * a]
x.sort()
print(x[0])


(num, num1) = input('').split()
num = int(num)
num1 = int(num1)
if num <= num1:
	for i in range(num1):
		print(num, end='')
else:
	for i in range(num):
		print(num1, end='')


vals = list(map(int, input().split()))
(min_val, max_val) = sorted(vals)
ret = str(min_val) * max_val
print(ret)


(a, b) = input().split()
a1 = a * int(b)
a2 = b * int(a)
print(min(a1, a2))


(a, b) = input().split()
dic = [a * int(b), b * int(a)]
dic.sort()
print(dic[0])


(a, b) = map(int, input().split())
ans = []
ans.append(a)
ans.append(b)
ans = sorted(ans)
anser = ''
for i in range(ans[1]):
	anser += str(ans[0])
print(anser)


(N, M) = input().split()
x = M * int(N)
y = N * int(M)
print(min(x, y))


(a, b) = [int(i) for i in input().split()]
print(min(str(a) * b, str(b) * a))


(a, b) = map(int, input().split())
m = min(a, b)
M = max(a, b)
print(str(m) * M)


(a, b) = map(int, input().split())
s = str(min(a, b))
x = max(a, b)
print(s * x)


(a, b) = map(int, input().split())
s = [a] * b
t = [b] * a
ab = map(str, s)
ba = map(str, t)
if a <= b:
	print(''.join(ab))
else:
	print(''.join(ba))


(a, b) = input().split()
str = ''
if int(a) <= int(b):
	for _ in range(int(b)):
		str += a
else:
	for _ in range(int(a)):
		str += b
print(str)


(a, b) = input().split()
c = a * int(b)
d = b * int(a)
A = [c, d]
print(sorted(A)[0])