You are given a string $s$ consisting of $n$ lowercase Latin letters.

You have to remove at most one (i.e. zero or one) character of this string in such a way that the string you obtain will be lexicographically smallest among all strings that can be obtained using this operation.

String $s = s_1 s_2 \dots s_n$ is lexicographically smaller than string $t = t_1 t_2 \dots t_m$ if $n < m$ and $s_1 = t_1, s_2 = t_2, \dots, s_n = t_n$ or there exists a number $p$ such that $p \le min(n, m)$ and $s_1 = t_1, s_2 = t_2, \dots, s_{p-1} = t_{p-1}$ and $s_p < t_p$.

For example, "aaa" is smaller than "aaaa", "abb" is smaller than "abc", "pqr" is smaller than "z".


-----Input-----

The first line of the input contains one integer $n$ ($2 \le n \le 2 \cdot 10^5$) — the length of $s$.

The second line of the input contains exactly $n$ lowercase Latin letters — the string $s$.


-----Output-----

Print one string — the smallest possible lexicographically string that can be obtained by removing at most one character from the string $s$.


-----Examples-----
Input
3
aaa

Output
aa

Input
5
abcda

Output
abca



-----Note-----

In the first example you can remove any character of $s$ to obtain the string "aa".

In the second example "abca" < "abcd" < "abcda" < "abda" < "acda" < "bcda".

Difficulty: EASY

Solutions:
def readint():
	return int(input())

def readline():
	return [int(c) for c in input().split()]

def main():
	n = readint()
	string = input()
	if len(set(string)) == 1:
		print(string[:n - 1])
		return
	for i in range(1, n):
		if string[i] < string[i - 1]:
			print(string[:i - 1] + string[i:])
			return
	string = list(string)
	del string[string.index(max(string))]
	print(''.join(string))
main()


n = int(input())
s = input()
l = list(s)
for i in range(n - 1):
	if ord(s[i]) > ord(s[i + 1]):
		l.pop(i)
		break
if len(l) == n:
	print(s[:-1])
else:
	print(''.join(l))


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import defaultdict
import sys
MAX = sys.maxsize
MAXN = 10 ** 6 + 10

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b, x, y):
	return abs(a - x) + abs(b - y)

def numIN():
	return map(int, sys.stdin.readline().strip().split())

def charIN():
	return sys.stdin.readline().strip().split()
n = int(input())
s = input()
x = -1
for i in range(n - 1):
	if s[i] > s[i + 1]:
		x = s[i]
		break
if x == -1:
	print(s[:n - 1])
else:
	z = [i for i in s]
	z.remove(x)
	print(''.join(z))


n = int(input())
s = input()
pos = n - 1
for i in range(n - 1):
	if s[i] > s[i + 1]:
		pos = i
		break
print(s[0:pos] + s[pos + 1:n])


n = int(input())
s = input()
for i in range(n - 1):
	if s[i] > s[i + 1]:
		exit(print(s[:i] + s[i + 1:]))
print(s[:n - 1])


n = int(input())
s = input()
al = 'abcdefghijklmnopqrstuvwxyz'
for i in range(n - 1):
	if al.index(s[i]) > al.index(s[i + 1]):
		print(s[:i] + s[i + 1:])
		break
else:
	print(s[:n - 1])


n = int(input())
a = input()
for i in range(n - 1):
	if ord(a[i]) > ord(a[i + 1]):
		print(a[:i] + a[i + 1:])
		exit(0)
print(a[:n - 1])


n = int(input())
t = input()
for i in range(n - 1):
	if t[i] > t[i + 1]:
		t = t[:i] + t[i + 1:]
		break
if len(t) == n:
	print(t[:n - 1])
else:
	print(t)


n = int(input())
s = input()
f = 0
a = ''
for i in range(n - 1):
	if s[i] > s[i + 1]:
		f = 1
		a = s[:i] + s[i + 1:]
		break
if f == 0:
	a = s[:n - 1]
print(a)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]
n = int(input())
s = list(input())
ind = n - 1
for i in range(n - 1):
	if s[i + 1] < s[i]:
		ind = i
		break
s.remove(s[ind])
print(''.join(s))


n = int(input())
s = list(input())
ind = n - 1
for i in range(n - 1):
	if s[i] > s[i + 1]:
		ind = i
		break
s.pop(ind)
print(''.join(s))


n = int(input())
s = input()
x = []
y = []
for i in s:
	x.append(i)
i = 1
f = 0
while i < len(x):
	if ord(x[i - 1]) > ord(x[i]):
		x.pop(i - 1)
		f = 1
		break
	else:
		i = i + 1
if i == len(x) and f == 0:
	x.pop(-1)
	print(''.join(x))
else:
	print(''.join(x))


n = int(input())
s = input()
for i in range(1, n):
	if s[i] < s[i - 1]:
		s = s[:i - 1] + s[i:]
		print(s)
		break
else:
	print(s[:-1])


n = int(input())
l = list(input())
f = 0
for i in range(0, n - 1):
	if l[i] > l[i + 1]:
		l[i] = ''
		f = 1
		break
if f == 0:
	l[n - 1] = ''
print(*l, sep='')


n = int(input())
s = input()
x = False
for i in range(n - 1):
	if s[i] > s[i + 1]:
		x = True
		break
if x:
	print(s[0:i] + s[i + 1:n])
else:
	print(s[:-1])


n = int(input())
x = input()
y = ''
for i in range(len(x) - 1):
	if x[i] > x[i + 1]:
		y = x[0:i] + x[i + 1:]
		break
print(y) if y != '' else print(x[:-1])


def f(s):
	for i in range(len(s) - 1):
		if s[i + 1] < s[i]:
			return s[:i] + s[i + 1:]
	return s[:-1]
a = input()
s = input()
print(f(s))


def main():
	n = int(input())
	s = input()
	for i in range(1, n):
		if ord(s[i - 1]) > ord(s[i]):
			return s[:i - 1] + s[i:]
	return s[:-1]
print(main())


n = int(input())
s = input()
i = n - 1
for x in range(n - 1):
	if s[x] > s[x + 1]:
		i = x
		break
for x in range(n):
	if x != i:
		print(s[x], end='')


n = int(input())
s = list(input())
i = 0
answer = False
while i < n - 1:
	if s[i + 1] < s[i]:
		s.pop(i)
		answer = True
		break
	elif s[i + 1] == s[i]:
		x = i
		i += 1
		while i < n - 1:
			if s[i + 1] <= s[i]:
				i += 1
			else:
				break
		if i == n - 1:
			answer = True
			s.pop(x)
			break
	else:
		i += 1
if n != 1 and (not answer):
	print(''.join(s[:-1]))
else:
	print(''.join(s))


n = int(input())
s = str(input())
ans = s[:n - 1]
for i in range(0, n - 1):
	if s[i] > s[i + 1]:
		ans = min(ans, s[:i] + s[i + 1:])
		break
print(ans)


input()
s = input()
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		print(s[:i] + s[i + 1:])
		break
else:
	print(s[:-1])


import sys
from array import array
import typing as Tp

def input():
	return sys.stdin.buffer.readline().decode('utf-8')

def main():
	n = int(input())
	s = input().rstrip() + '?'
	for i in range(n):
		if s[i] > s[i + 1]:
			s = s[:i] + s[i + 1:-1]
			break
	print(s)
main()


n = int(input())
s = input()
res = s
if n > 1:
	i = 0
	while i + 1 < n and s[i] <= s[i + 1]:
		i += 1
	res = s[0:i] + s[i + 1:]
print(res)


n = int(input())
s = input()
for i in range(len(s) - 1):
	if ord(s[i]) > ord(s[i + 1]):
		print(s[:i] + s[i + 1:])
		exit(0)
print(s[:-1])


(n, s) = (input(), input())
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		print(s[:i] + s[i + 1:])
		exit()
print(s[:-1])


n = int(input())
s = input()
i = next((i for i in range(n - 1) if s[i] > s[i + 1]), n - 1)
print(s[:i] + s[i + 1:])


from typing import Dict, List, Tuple

def input_lst() -> List[int]:
	return [int(x) for x in input().split()]

def print_out(res: List[int]):
	print(' '.join([str(x) for x in res]))

def main():
	(n,) = (int(x) for x in input().split())
	s = input()
	for i in range(len(s) - 1):
		if s[i] > s[i + 1]:
			print(s[:i] + s[i + 1:])
			return
	print(s[:-1])

def __starting_point():
	main()
__starting_point()


n = int(input())
l = list(input())
for i in range(n - 1):
	if l[i] > l[i + 1]:
		l.pop(i)
		break
if n == len(l):
	l.pop()
print(''.join(l))


n = int(input())
a = input()
b = list(a)
if n == 1:
	print(a)
else:
	f = 1
	for i in range(len(b) - 1):
		if ord(b[i]) > ord(b[i + 1]):
			del b[i]
			f = 0
			break
	if f == 1:
		del b[-1]
	print(''.join(map(str, b)))


n = int(input())
tmp = input()
pos = 0
arr = []
for i in tmp:
	arr.append(i)
f = 0
for i in range(n - 1):
	if arr[i + 1] < arr[i]:
		arr[i] = -1
		f = 1
		break
if f:
	for i in arr:
		if i != -1:
			print(i, end='')
else:
	for i in range(n - 1):
		print(arr[i], end='')


n = int(input())
s = input()
k = n - 1
for i in range(1, n):
	if s[i] < s[i - 1]:
		k = i - 1
		break
for i in range(n):
	if i == k:
		continue
	print(s[i], end='')


n = int(input())
s = input()
i = 1
while i < n and s[i - 1] <= s[i]:
	i += 1
print(s[:i - 1] + s[i:])


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

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

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def main():
	n = I()
	s = S()
	for i in range(n - 1):
		if s[i] > s[i + 1]:
			return s[:i] + s[i + 1:]
	return s[:-1]
print(main())


n = int(input())
a = input()
x = 0
for i in range(n - 1):
	if ord(a[i]) <= ord(a[i + 1]):
		pass
	else:
		x = 1
		break
if x == 1:
	print(a[:i] + a[i + 1:])
else:
	print(a[:-1])


n = int(input())
st = input()
for i in range(len(st) - 1):
	if st[i] > st[i + 1]:
		print(st[0:i] + st[i + 1:])
		break
else:
	print(st[:len(st) - 1])


length = int(input())
text = input()
for i in range(length - 1):
	if text[i] > text[i + 1]:
		new_text = text[:i] + text[i + 1:]
		i = i + 1
		break
if i == length - 2:
	new_text = text[:length - 1]
print(new_text)


n = int(input())
a = input()
i = 1
while i < n and a[i - 1] <= a[i]:
	i += 1
print(a[0:i - 1] + a[i:n])


n = int(input())
s = input()
z = '0'
for i in range(n - 1):
	if s[i] > s[i + 1] and z == '0':
		z = '1'
		pass
	else:
		print(s[i], end='')
if z == '1':
	print(s[n - 1])


import sys
import collections
from collections import Counter
import itertools
import math
import timeit

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

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

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
n = ii()
s = input()
for i in range(n - 1):
	if s[i] > s[i + 1]:
		exit(print(s[:i] + s[i + 1:]))
print(s[:-1])


import math
from decimal import Decimal
import heapq

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)
input()
s = input()
i = 1
while i < len(s) and s[i - 1] <= s[i]:
	i += 1
for j in range(len(s)):
	if j != i - 1:
		print(s[j], end='')


n = int(input())
s = input()
f = 0
res = ''
for i in range(1, n):
	if ord(s[i - 1]) > ord(s[i]):
		f = 1
		break
if f == 1:
	res = s[:i - 1] + s[i:]
else:
	res = s[0:n - 1]
print(res)


t = int(input())
s = input()
ans = ''
for i in range(t - 1):
	if s[i] > s[i + 1]:
		ans = s[0:i] + s[i + 1:]
		break
if ans == '':
	ans = s[0:t - 1]
print(ans)


n = int(input())
l = list(input())
ans = ''
flag = 0
for i in range(n - 1):
	if l[i] > l[i + 1] and flag == 0:
		flag = 1
	else:
		ans += l[i]
if len(ans) != n - 1:
	ans += l[n - 1]
print(ans)


n = int(input())
str = input()

def get_ans(str):
	if len(str) == 1:
		return ''
	for i in range(len(str) - 1):
		if str[i] > str[i + 1]:
			return str[0:i] + str[i + 1:]
	return str[:len(str) - 1]
print(get_ans(str))


(n, s) = (int(input()), input())
if all((s[i] <= s[i + 1] for i in range(n - 1))):
	if n > 1:
		print(s[:-1])
	else:
		print(s)
else:
	i = list(filter(lambda i: s[i] > s[i + 1], range(n - 1)))[0]
	print(s[:i] + s[i + 1:])


n = int(input())
s = input()
funk = lambda ss, i: ''.join([ss[k] for k in range(len(ss)) if k != i])
print(s if n == 1 else funk(s, ([i for i in range(n - 1) if s[i + 1] < s[i]] + [n - 1])[0]))


n = int(input())
s = input()
az = 'abcdefghijklmnopqrstuvwxyz'
az_dict = {}
for i in range(len(az)):
	az_dict[az[i]] = i
s_list = list(s)
not_used = [True] * len(s)
out_txt = ''
flag = False
for i in range(n - 1):
	val1 = az_dict[s[i]]
	val2 = az_dict[s[i + 1]]
	if val1 > val2:
		s_list.remove(s[i])
		flag = True
		break
if flag == False:
	s_list = s_list[:-1]
out_txt = ''.join(s_list)
print(out_txt)


n = int(input())
s = input()
result = []
curmax = 'a'
flag = True
i = 0
while i < len(s):
	if s[i] >= curmax:
		curmax = s[i]
		result.append(s[i])
	else:
		result.pop()
		result.extend(s[i:])
		print(''.join(result))
		flag = False
		break
	i += 1
if flag:
	result.pop()
	print(''.join(result))


n = int(input())
s = [x for x in input().strip()]
ptd = len(s) - 1
i = 0
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		ptd = i
		break
del s[ptd]
print(*s, sep='')


n = int(input())
string = input()
for i in range(n - 1):
	if string[i] > string[i + 1]:
		print(string[:i] + string[i + 1:])
		exit(0)
print(string[:n - 1])


n = int(input())
fl = input()
l = []
i = 0
l = list(fl)
i = 0
while i < n - 1:
	if l[i] > l[i + 1]:
		l.pop(i)
		break
	i += 1
if len(l) == n:
	l.pop()
print(''.join(l))


n = int(input())
s = input()
i = 0
while i < n - 1:
	if s[i] > s[i + 1]:
		break
	i += 1
print(s[:i] + s[i + 1:])


def main():
	temp = int(input().strip())
	s = input().strip()
	answer = ''
	for i in range(len(s) - 1):
		if s[i] <= s[i + 1]:
			answer += s[i]
		else:
			answer += s[i + 1:]
			break
	print(answer)
main()


n = int(input())
s = input()
k = 0
for i in range(len(s)):
	if i != len(s) - 1 and s[i] > s[i + 1]:
		print(s[:i] + s[i + 1:])
		k = 1
		break
if k == 0:
	print(s[:len(s) - 1])


n = int(input())
s = list(input())
p = s.copy()
for i in range(n - 1):
	if s[i] > s[i + 1]:
		s.pop(i)
		break
if p == s:
	s.pop(n - 1)
for item in s:
	print(item, end='')


def main():
	n = int(input())
	s = input()
	solver(s)

def solver(s):
	for i in range(len(s) - 1):
		if s[i] > s[i + 1]:
			print(s[:i] + s[i + 1:])
			return
	print(s[:len(s) - 1])
	return
main()


import sys
f = sys.stdin
n = int(f.readline().rstrip())
s = f.readline().rstrip()
temp = 0
if n == 1:
	print(s)
else:
	for i in range(n - 1):
		if i + 1 == 1:
			if s[1] < s[0]:
				print(s[1:])
				temp = 1
				break
		elif s[i + 1] < s[i]:
			print(s[:i] + s[i + 1:])
			temp = 1
			break
	if temp == 0:
		print(s[:n - 1])


a = input()
a = input()
for i in range(len(a)):
	if i == len(a) - 1:
		print(a[:i])
	elif a[i] > a[i + 1]:
		print(a[:i] + a[i + 1:])
		break


n = int(input())
s = input()
p = ''
for i in range(n - 1):
	if s[i] > s[i + 1]:
		p = s[:i] + s[i + 1:]
		break
	if i == n - 2:
		p = s[:-1]
print(p)


from sys import stdin, stdout
n = int(input())
fl = stdin.readline()
l = []
i = 0
l = list(fl)
l = l[0:-1]
i = 0
while i < n - 1:
	if l[i] > l[i + 1]:
		l.pop(i)
		break
	i += 1
if len(l) == n:
	l.pop()
print(''.join(l))


n = input()
x = input()
flag = 0
for i in range(0, len(x) - 1):
	if x[i] > x[i + 1]:
		flag = 1
		break
if flag == 1:
	print(x[0:i] + x[i + 1:len(x)])
else:
	print(x[0:len(x) - 1])


n = int(input())
s = list(input())
t = 1
for i in range(n - 1):
	if ord(s[i]) > ord(s[i + 1]):
		s.pop(i)
		t -= 1
	if t == 0:
		break
if t == 1:
	for i in range(n - 1, 0, -1):
		if ord(s[i]) >= ord(s[i - 1]):
			s.pop(i)
			t -= 1
		if t == 0:
			break
print(''.join(s))


import configparser
import sys
input = sys.stdin.readline

def ceil_div(x, y):
	return -(-x // y)

def main():
	n = int(input())
	s = input().strip()
	for i in range(n - 1):
		if s[i] <= s[i + 1]:
			continue
		else:
			print(s[0:i] + s[i + 1:])
			return
	print(s[:-1])
main()


n = int(input())
s = input()
flag = False
for i in range(n - 1):
	if s[i] > s[i + 1]:
		print(s[:i] + s[i + 1:])
		flag = True
		break
if not flag:
	print(s[:-1])


n = int(input())
str = input()
i = 0
while i < n - 1 and str[i] <= str[i + 1]:
	i += 1
print(str[:i] + str[i + 1:])


n = int(input())
s = input()
s += '1'
t = True
for i in range(n):
	if t and s[i] > s[i + 1]:
		t = False
	else:
		print(s[i], end='')


str_len = int(input())
string = input()
for (num, i) in enumerate(string[:-1]):
	if string[num] > string[num + 1]:
		print(string[:num] + string[num + 1:])
		break
else:
	print(string[:-1])


n = int(input())
s = input()
res = ''
op = False
for i in range(0, n - 1):
	if s[i] <= s[i + 1]:
		res = res + s[i]
	elif not op:
		op = True
	else:
		res = res + s[i]
res = res + s[n - 1]
if not op:
	print(res[:-1])
else:
	print(res)


n = int(input())
s = input()
s = list(s)
for i in range(1, len(s)):
	if s[i - 1] > s[i]:
		del s[i - 1]
		break
else:
	del s[len(s) - 1]
print(''.join(s))


n = int(input())
s = input()
a = s.find(max(s))
for i in range(n - 1):
	if s[i] > s[i + 1]:
		a = i
		break
print(s[0:a] + s[a + 1:])


n = int(input())
s = input()
i = 0
while i < n - 1:
	if s[i] <= s[i + 1]:
		pass
	else:
		break
	i += 1
print(s[:i] + s[i + 1:])


import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)

def getIntList():
	return list(map(int, input().split()))
try:
	import numpy

	def dprint(*args, **kwargs):
		print(*args, file=sys.stderr)
	dprint('debug mode')
except Exception:

	def dprint(*args, **kwargs):
		pass
inId = 0
outId = 0
if inId > 0:
	dprint('use input', inId)
	sys.stdin = open('input' + str(inId) + '.txt', 'r')
if outId > 0:
	dprint('use output', outId)
	sys.stdout = open('stdout' + str(outId) + '.txt', 'w')
	atexit.register(lambda : sys.stdout.close())
(N,) = getIntList()
s = input()
for i in range(1, N):
	if s[i - 1] > s[i]:
		print(s[:i - 1] + s[i:])
		sys.exit()
print(s[:-1])


n = int(input())
string = list(input())
for i in range(n - 1):
	if ord(string[i]) > ord(string[i + 1]):
		del string[i]
		break
else:
	del string[-1]
print(''.join(string))


n = int(input())
c = str(input())
res = ''
found = False
pos = n - 1
for i in range(0, n - 1):
	if ord(c[i]) > ord(c[i + 1]):
		pos = i
		break
print(c[0:pos] + c[pos + 1:n])


n = int(input())
s = list(input())
m = n - 1
for i in range(n - 1):
	if s[i] > s[i + 1]:
		m = i
		break
s[m] = ''
for ch in s:
	print(ch, end='')


input()
s = input()
for (index, each) in enumerate(s):
	if index != 0 and each < s[index - 1]:
		print(s[:index - 1] + s[index:])
		break
else:
	print(s[:-1])


x = int(input())
string = input()
i = 0
for i in range(x - 1):
	if string[i] > string[i + 1]:
		print(string[:i] + string[i + 1:])
		break
else:
	print(string[:-1])


a = int(input())
b = str(input())
answer = ''
for x in range(a):
	if x == a - 1:
		answer = b[:a - 1]
		break
	elif b[x] > b[x + 1]:
		answer = b[:x] + b[x + 1:]
		break
print(answer)


n = int(input())
text = input()
remove_idx = -1
for i in range(len(text) - 1):
	if ord(text[i]) - ord(text[i + 1]) > 0:
		remove_idx = i
		break
if remove_idx >= 0:
	print(text[:remove_idx] + text[remove_idx + 1:])
else:
	print(text[:-1])


pocPism = int(input())
pismena = input()
pomocka = 0
x = pocPism - 1
for i in range(pocPism):
	if ord(pismena[i]) <= pomocka - 1:
		x = i - 1
		break
	pomocka = ord(pismena[i])
for i in range(pocPism):
	if i != x:
		print(pismena[i], end='')
print()


n = int(input())
huruf = input()
hurufs = ['a' for i in range(n)]
for i in range(n):
	hurufs[i] = huruf[i]
for i in range(len(huruf) - 1):
	if huruf[i + 1] < huruf[i]:
		hurufs.remove(hurufs[i])
		break
else:
	hurufs.remove(hurufs[len(huruf) - 1])
for i in range(n - 1):
	print(hurufs[i], end='')


import time
import collections
import math

class Time_test:

	def __enter__(self):
		self.enter_time = time.time()

	def __exit__(self, exc_type, exc_val, exc_tb):
		print('Command was executed in', time.time() - self.enter_time)
n = int(input())
ipt = [x for x in input()]
for i in range(1, len(ipt)):
	if ipt[i - 1] > ipt[i]:
		ipt.pop(i - 1)
		print(*ipt, sep='')
		break
else:
	print(*[ipt[x] for x in range(len(ipt) - 1)], sep='')


n = int(input())
s = input()
ans = s
s = list(s)
i = 0
while i < len(s) - 1 and s[i] <= s[i + 1]:
	i += 1
if i == len(s) - 1:
	print(ans[:-1])
else:
	k = s.pop(i)
	print(min(''.join(s), ans))


def solve(s, n):
	idx = n - 1
	for i in range(1, n):
		if s[i] < s[i - 1]:
			idx = i - 1
			break
	return s[:idx] + s[idx + 1:]

def main():
	n = int(input())
	s = input()
	print(solve(s, n))
main()


import sys
n = int(sys.stdin.readline().strip())
s = sys.stdin.readline().strip()
for i in range(n - 1):
	if s[i] > s[i + 1]:
		r = s[:i] + s[i + 1:]
		print(r)
		break
else:
	print(s[:-1])


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	n = ii()
	s = list(si())
	for i in range(n - 1):
		if s[i] > s[i + 1]:
			del s[i]
			break
	if len(s) == n:
		del s[n - 1]
	for i in range(n - 1):
		print(s[i], end='')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())
t = ii()
s = si()
s = list(s)
f = -1
for i in range(1, t):
	if s[i - 1] > s[i]:
		f = i - 1
		break
if f == -1:
	s = s[:-1]
	print(''.join(s))
else:
	s = s[:f] + s[f + 1:]
	print(''.join(s))


n = int(input())
s = input()
k = 1
for i in range(n - 1):
	if s[i] > s[i + 1]:
		k = 0
		c = s[:i] + s[i + 1:]
		break
if k:
	t = s.replace(max(list(s)), '', 1)
	print(t)
else:
	print(c)


import sys
n = int(sys.stdin.readline())
s = sys.stdin.readline().strip()
i = 0
while i < len(s) - 1 and s[i + 1] >= s[i]:
	i += 1
if i == len(s) - 1 and len(s) > 0:
	print(s[:-1])
elif len(s) > 0:
	print(s[:i] + s[i + 1:])
else:
	print('')


n = int(input())
s = str(input())

def minimize(s):
	new_s = ''
	for i in range(len(s) - 1):
		if ord(s[i + 1]) < ord(s[i]):
			to_ret = s[:i] + s[i + 1:]
			return to_ret
		else:
			new_s += s[i]
	if len(new_s) != len(s):
		return new_s
	else:
		return new_s[:-1]
print(minimize(s))


x = int(input())
s = [ord(n) for n in input()]
p = 0
if min(s) == max(s):
	del s[0]
else:
	for n in range(x - 1):
		if s[n] > s[n + 1]:
			del s[n]
			p = 1
			break
	if p == 0:
		del s[x - 1]
for n in s:
	print(chr(n), end='')


n = int(input())
s = input()
k = 0
ans = ''
flag = False
for i in range(n - 1):
	if ord(s[i]) > ord(s[i + 1]):
		flag = True
		k = i + 1
		break
	else:
		ans += s[i]
if flag:
	ans += s[k:]
print(ans)


n = int(input())
s = str(input())
for i in range(n - 1):
	if s[i] > s[i + 1]:
		print(s[0:i] + s[i + 1:])
		raise SystemExit
print(s[0:n - 1])


len = int(input())
s = input()

def remove(s):
	if not s:
		return []
	for i in range(len - 1):
		if s[i] > s[i + 1]:
			return s[0:i] + s[i + 1:]
	return s[:-1]
print(remove(s))


import math as mt
t = 1
for _ in range(t):
	n = int(input())
	s = input()
	ind = -1
	maxi = max(s)
	for i in range(n - 1):
		if s[i] > s[i + 1]:
			ind = i
			break
	for i in range(n):
		if maxi == s[i]:
			ind1 = i
			break
	if ind != -1:
		print(s[:ind] + s[ind + 1:])
	else:
		print(s[:ind1] + s[ind1 + 1:])


n = int(input())
s = [i for i in input()]
for i in range(n - 1):
	if s[i] > s[i + 1]:
		s.pop(i)
		break
if len(s) == n:
	s.pop()
print(''.join(s))


n = int(input())
s = input()
if len(set(s)) == 1:
	print(s[0:n - 1])
else:
	s = s + '\x00'
	l = list(s)
	for i in range(len(l) - 1):
		if l[i] > l[i + 1]:
			l.remove(l[i])
			break
	print(''.join(l[0:len(l) - 1]))


n = int(input())
string = input()
done = 0
for ind in range(len(string) - 1):
	if string[ind] > string[ind + 1]:
		string = string[:ind] + string[ind + 1:]
		done = 1
		break
if done == 0:
	string = string[:-1]
print(string)


n = int(input())
s = input()
x = ''
for i in range(n - 1):
	if s[i] > s[i + 1]:
		x = s[i]
		break
if x == '':
	print(s[:n - 1])
else:
	s = s.replace(x, '', 1)
	print(''.join(s))


n = int(input())
st = list(input())
falg = 1
for i in range(n - 1):
	if st[i] > st[i + 1]:
		st.remove(st[i])
		falg = 0
		break
if falg == 1:
	st.pop(n - 1)
for i in range(len(st)):
	print(st[i], end='')


n = int(input())
s = input()
x = ''
for (i, y) in enumerate(s):
	if y < x:
		break
	x = y
if x != y:
	print(s[:i - 1] + s[i:])
else:
	print(s[:n - 1])


n = int(input())
line = list(input())
rev = False
for i in range(n - 1):
	if ord(line[i]) > ord(line[i + 1]):
		ans = i
		rev = True
		break
if rev:
	line.pop(i)
else:
	line.pop(-1)
print(''.join(line))


n = int(input())
s = input()
s_list = list(s)
flag = False
max_letter = s_list[0]
max_index = 0
for i in range(1, len(s_list)):
	if s_list[i - 1] > s_list[i]:
		flag = True
		del s_list[i - 1]
		break
	elif max_letter < s_list[i]:
		max_letter = s_list[i]
		max_index = i
if flag:
	s = ''.join(s_list)
else:
	del s_list[max_index]
	s = ''.join(s_list)
print(s)


n = int(input())
s1 = input()
pos = n - 1
for i in range(n):
	if i + 1 < n and s1[i] > s1[i + 1]:
		pos = i
		break
if pos != n - 1:
	print(s1[:i] + s1[i + 1:])
else:
	print(s1[:i])


def main():
	n = int(input())
	s = input()
	alphabet = ['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']

	def isGreaterLetter(l1, l2):
		return alphabet.index(l1) > alphabet.index(l2)

	def popString(s1, i):
		l = list(s1)
		l.pop(i)
		return ''.join(l)
	if n == 1:
		return s
	else:
		for i in range(n - 1):
			if isGreaterLetter(s[i], s[i + 1]):
				return popString(s, i)
		return popString(s, n - 1)
print(main())


(n, s) = (int(input()), input())
for (ch1, ch2, i) in zip(s, s[1:], range(n)):
	if ch1 > ch2:
		print(s[:i] + s[i + 1:])
		break
else:
	print(s[:-1])


def main():
	n = int(input())
	s = input()
	new = ''
	index = -1
	for i in range(n - 1):
		if s[i] > s[i + 1]:
			index = i
			break
	if index == -1:
		new = s[:n - 1]
	else:
		for i in range(n):
			if i != index:
				new += s[i]
	print(new)
main()


n = int(input())
t = input()
if 2 <= 2 <= 2 * 10 ** 5:
	for i in range(n - 1):
		if not t[i] <= t[i + 1]:
			print(t[:i] + t[i + 1:])
			break
	else:
		print(t[:-1])


def get_smallest(string):
	for idx in range(len(string) - 1):
		if string[idx] > string[idx + 1]:
			return string[:idx] + string[idx + 1:]
	return string[:-1]
n = int(input())
string = input()
result = get_smallest(string)
print(result)


n = int(input())
s = input()
hoho = n - 1
for x in range(n - 1):
	if ord(s[x]) > ord(s[x + 1]):
		hoho = x
		break
print(s[:hoho] + s[hoho + 1:])


import collections
n = int(input())
s = input()
c = collections.Counter(s)
if len(c) == 1:
	print(s[:-1])
else:
	for i in range(n):
		if i + 1 == n:
			print(s[:-1])
			break
		elif s[i] > s[i + 1]:
			print(s[:i] + s[i + 1:])
			break


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10 ** 5)
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
n = int(input())
l = list(input())
flag = -1
for i in range(1, n):
	if l[i] >= l[i - 1]:
		continue
	else:
		flag = i - 1
		break
if flag != -1:
	print(''.join(l[:flag] + l[flag + 1:]))
	exit()
print(''.join(l[:len(l) - 1]))


import sys
input = sys.stdin.readline
n = int(input())
s = input().strip()
found = False
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		s = s[0:i] + s[i + 1:]
		found = True
		break
if found:
	print(s)
else:
	print(s[:-1])


t = int(input())
s = input()
res = ''
trans = False
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		print(s[i + 1], end='')
		trans = True
		break
	else:
		print(s[i], end='')
if trans:
	print(s[i + 2:])


def go():
	n = int(input())
	a = [i for i in input()]
	for i in range(n - 1):
		if a[i] > a[i + 1]:
			a.pop(i)
			break
	else:
		a.pop()
	return ''.join(a)
print(go())


length = int(input())
palabra = input()
position = 0
for i in range(len(palabra) - 1):
	if palabra[i] > palabra[i + 1]:
		position = i
		break
	if i == len(palabra) - 2:
		position = len(palabra) - 1
nueva = ''
for j in range(len(palabra)):
	if j != position:
		nueva += palabra[j]
if len(palabra) > 1:
	print(nueva)
else:
	print(palabra)


n = int(input())
st = input()
st = st + '\x00'
for i in range(n):
	if st[i] > st[i + 1]:
		pos = i
		break
print(st[:pos] + st[pos + 1:-1])


abc = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
string = input()
index = -1
for i in range(len(string) - 1):
	if abc.index(string[i]) > abc.index(string[i + 1]):
		index = i
		break
listabc = list(string)
if index == -1:
	del listabc[len(string) - 1]
else:
	del listabc[index]
output = ''.join(listabc)
print(output)


from sys import stdin, stdout
from itertools import accumulate
N = int(input())
s = input()
for i in range(1, N):
	if s[i] < s[i - 1]:
		print(s[:i - 1] + s[i:])
		quit()
print(s[:N - 1])


n = int(input())
a = str(input())
a = list(a)
for i in range(n - 1):
	if a[i] > a[i + 1]:
		a.remove(a[i])
		break
if len(a) == n:
	a.remove(a[n - 1])
print(''.join(a))


import math
import bisect
import itertools
import sys
mod = 10 ** 9 + 7

def mindiff(a):
	b = a[:]
	b.sort()
	m = 10000000000
	for i in range(len(b) - 1):
		if b[i + 1] - b[i] < m:
			m = b[i + 1] - b[i]
	return m

def lcm(a, b):
	return a * b // math.gcd(a, b)

def merge(a, b):
	i = 0
	j = 0
	c = 0
	ans = []
	while i < len(a) and j < len(b):
		if a[i] < b[j]:
			ans.append(a[i])
			i += 1
		else:
			ans.append(b[j])
			c += len(a) - i
			j += 1
	ans += a[i:]
	ans += b[j:]
	return (ans, c)

def mergesort(a):
	if len(a) == 1:
		return (a, 0)
	mid = len(a) // 2
	(left, left_inversion) = mergesort(a[:mid])
	(right, right_inversion) = mergesort(a[mid:])
	(m, c) = merge(left, right)
	c += left_inversion + right_inversion
	return (m, c)

def is_prime(num):
	if num == 2:
		return True
	if num == 3:
		return True
	if num % 2 == 0:
		return False
	if num % 3 == 0:
		return False
	t = 5
	a = 2
	while t <= int(math.sqrt(num)):
		if num % t == 0:
			return False
		t += a
		a = 6 - a
	return True

def ceil(a, b):
	if a % b == 0:
		return a // b
	else:
		return a // b + 1

def binsearch(arr, b, low, high):
	if low == high:
		return low
	if arr[math.ceil((low + high) / 2)] < b:
		return binsearch(arr, b, low, math.ceil((low + high) / 2) - 1)
	else:
		return binsearch(arr, b, math.ceil((low + high) / 2), high)

def ncr1(n, r):
	s = 1
	for i in range(min(n - r, r)):
		s *= n - i
		s %= mod
		s *= pow(i + 1, mod - 2, mod)
		s %= mod
	return s

def calc(n, m, r):
	s = 0
	for i in range(0, r + 1, 2):
		s += ncr1(n, i) * ncr1(m, i)
		s %= mod
	return s
n = int(input())
a = list(input())
for i in range(len(a) - 1):
	if a[i] > a[i + 1]:
		del a[i]
		exit(print(''.join(a)))
exit(print(''.join(a[:n - 1])))


n = int(input())
a = input()
check = True
for j in range(n - 1):
	if a[j] > a[j + 1]:
		a = a[:j] + a[j + 1:]
		check = False
		break
if check:
	print(a[:-1])
else:
	print(a)


n = int(input())
str = input()
max_id = 0
for i in range(n):
	if i + 1 < n and str[i] <= str[i + 1]:
		max_id = i + 1
	else:
		break
new_str = str[:max_id] + str[max_id + 1:]
print(new_str)


n = int(input())
s = input().strip()
j = 0
while j < n - 1:
	if s[j] > s[j + 1]:
		break
	else:
		j = j + 1
if j == n:
	s = s[:-1]
else:
	s = s[:j] + s[j + 1:]
print(s)


(N, X) = (int(input()), input())
Index = N - 1
for i in range(N - 2, -1, -1):
	if X[i] > X[i + 1]:
		Index = i
print(X[:Index] + X[Index + 1:])


(l, s) = (input(), input())
for i in range(0, len(s)):
	if i == len(s) - 1 or s[i] > s[i + 1]:
		print(s[:i] + s[i + 1:])
		break


from sys import stdin, stdout
from math import sin, tan, cos, pi, atan2, sqrt, acos, atan, factorial
n = int(stdin.readline())
s = stdin.readline().strip()
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		stdout.write(s[:i] + s[i + 1:])
		break
else:
	stdout.write(s[:-1])


num = int(input())
s = input()
output = None
for i in range(num - 1):
	if s[i + 1] < s[i]:
		output = s[:i] + s[i + 1:]
		break
if not output:
	output = s[:-1]
print(output)


n = int(input())
s = input()
out = ''
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		out = s[0:i] + s[i + 1:]
		break
print(out) if out != '' else print(s[:-1])


n = int(input())
s = str(input())
for i in range(n - 1):
	if s[i + 1] < s[i]:
		s = s[:i] + s[i + 1:]
		print(s)
		break
	elif i == n - 2:
		print(s[:n - 1])


t = int(input())
s = input()
ans = ''
flag = 0
for i in range(len(s) - 1):
	if ord(s[i]) > ord(s[i + 1]):
		x = i
		flag = 1
		break
if flag == 1:
	ans = s[0:i] + s[i + 1:]
	print(ans)
else:
	ans = s[:len(s) - 1]
	print(ans)


from collections import deque as de
import math
from collections import Counter as cnt

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic
n = int(input())
s = list(map(str, input()))
reqi = 0
ch = 0
for i in range(len(s)):
	if i < n - 1 and s[i + 1] < s[i]:
		reqi = i
		ch = 1
		break
if ch == 0:
	print(''.join(s[:n - 1]))
else:
	print(''.join(s[:reqi]) + ''.join(s[reqi + 1:]))


import sys, threading
sys.setrecursionlimit(10 ** 6)
scan = lambda : map(int, input().split())
n = int(input())
string = input()
ans = string
for i in range(n - 1):
	if string[i] > string[i + 1]:
		print(string[0:i] + string[i + 1:n])
		exit(0)
print(string[0:n - 1])


n = int(input())
str1 = input()
check = False
for index in range(0, n - 1):
	if str1[index] > str1[index + 1]:
		check = True
		break
if check == False:
	print(str1[:-1])
else:
	print(str1[:index] + str1[index + 1:])


n = int(input())
s = input()
ind = 0
for i in range(n - 1):
	if ord(s[i + 1]) < ord(s[i]):
		ind = i
		print(s[:ind] + s[ind + 1:])
		break
else:
	print(s[:n - 1])


input()
a = input()
big = a[0]
position = 0
m = 0
for i in range(len(a) - 1):
	if a[i] > a[i + 1]:
		position = i
		break
	if i == len(a) - 2:
		position = len(a) - 1
answer = ''
for e in range(len(a)):
	if e != position:
		answer += a[e]
if len(a) > 1:
	print(answer)
else:
	print(a)


n = int(input())
string = input()
lst = []
check = False
for i in range(n - 1):
	if string[i] > string[i + 1] and check == False:
		check = True
	else:
		lst.append(string[i])
if check == True:
	lst.append(string[n - 1])
print(''.join(lst))


n = int(input())
t = input()
s = str(t)
if len(set(s)) == 1:
	print(s[1:])
else:
	for i in range(len(s) - 1):
		if s[i] > s[i + 1]:
			print(s[:i] + s[i + 1:])
			break
	else:
		print(s[:len(s) - 1])


length = int(input())
s = input()
del_index = -1
for i in range(length - 1):
	if s[i + 1] < s[i]:
		del_index = i
		break
if del_index == -1:
	del_index = length - 1
print(s[0:del_index] + s[del_index + 1:])


n = int(input())
s = input()
(j, k) = (0, 1)
for i in range(n - 1):
	if s[i] > s[i + 1] and k == 1:
		j = 1
		k = 0
	else:
		print(s[i], end='')
if j == 1:
	print(s[n - 1])


q = int(input())
w = input()
e = -1
for i in range(0, len(w) - 1):
	if ord(w[i]) > ord(w[i + 1]):
		e = i
		break
if e != -1:
	for i in range(0, len(w)):
		if i != e:
			print(w[i], end='')
else:
	for i in range(0, len(w) - 1):
		print(w[i], end='')


n = int(input())
s = [*input()]
for i in range(n):
	if i == n - 1 or s[i] > s[i + 1]:
		del s[i]
		break
print(''.join(s))


n = int(input())
s = input()
r = s[:n - 1]
for i in range(1, n):
	if ord(s[i]) < ord(s[i - 1]):
		r = s[:i - 1] + s[i:]
		break
print(r)


_ = input()
s = list(input())
ans = []
deleted = False
prev = s[0]
for ch in s:
	if prev > ch and (not deleted):
		ans.pop()
		deleted = True
	ans.append(ch)
	prev = ch
if not deleted:
	ans.pop()
print(''.join(ans))


n = int(input())
str = input()
pos = n - 1
for i in range(pos):
	if str[i] > str[i + 1]:
		pos = i
		break
for i in range(n):
	if i != pos:
		print(str[i], end='')


n = int(input())
s = input()
i = 0
largest = False
for i in range(0, n - 1):
	if s[i] > s[i + 1]:
		largest = True
		break
if i == n - 2 and (not largest):
	print(s[:-1])
else:
	print(s[:i] + s[i + 1:])


n = int(input())
s = input()
v = 0
g = 0
for i in range(1, len(s)):
	if s[i] < s[i - 1]:
		g = 1
		v = i - 1
		break
if g:
	print(s[:v] + s[v + 1:])
else:
	print(s[:-1])


n = int(input())
string = input()
string_2 = '\n'
j = int(0)
for i in range(0, n - 1):
	if string[i] > string[i + 1]:
		string_2 = string[0:i] + string[i + 1:n]
		print(string_2)
		break
	elif string[i] < string[i + 1]:
		j = int(i + 1)
if '\n' in string_2:
	string_2 = string[0:j] + string[j + 1:n]
	print(string_2)


ln = int(input())
st = input()
for i in range(ln - 1):
	if ord(st[i]) > ord(st[i + 1]):
		print(st[:i] + st[i + 1:])
		break
else:
	print(st[:-1])


import sys
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 15
mod = 10 ** 9 + 7

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

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

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def solve(n, s):
	_set = set(list(s))
	ret = s
	for ch in _set:
		i = s.index(ch)
		ret = min(ret, s[:i] + s[i + 1:])
	return ret

def main():
	n = I()
	s = S()
	print(solve(n, s))
main()


n = int(input())
s = input()
i = 0
while i < n - 1:
	if s[i] > s[i + 1]:
		print(s[:i] + s[i + 1:])
		exit(0)
	i += 1
print(s[:-1])


s = input()
s = input()
last = 'a'
ind = -1
s = list(s)
for (x, i) in enumerate(s):
	if ord(i) < ord(last):
		ind = x - 1
		break
	last = i
s.pop(ind)
print(''.join(s))


def answer(s):
	for i in range(len(s) - 1):
		if s[i] > s[i + 1]:
			print(s[:i] + s[i + 1:])
			return
	print(s[:-1])
n = input()
answer(input())


n = int(input())
s = str(input())
flag = 0
k = ''
for i in range(1, n):
	if s[i - 1] > s[i]:
		k = s[:i - 1] + s[i:]
		flag = 1
		break
if flag == 0:
	k = s[:-1]
print(k)


from math import *
from collections import deque
from copy import deepcopy
import sys

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def multi():
	return map(int, input().split())

def strmulti():
	return map(str, inp().split())

def lis():
	return list(map(int, inp().split()))

def lcm(a, b):
	return a * b // gcd(a, b)

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def stringlis():
	return list(map(str, inp().split()))

def out(var):
	sys.stdout.write(str(var))

def printlist(a):
	print(' '.join((str(a[i]) for i in range(len(a)))))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
n = int(input())
a = str(input())
b = []
for i in a:
	b.append(ord(i))
flag = False
for i in range(n - 1):
	if b[i + 1] < b[i]:
		b.remove(b[i])
		flag = True
		break
if not flag:
	b = b[:n - 1]
for i in b:
	print(chr(i), end='')


n = int(input())
a = input()
a = list(a)
flag = -1
for i in range(n - 1):
	if a[i] > a[i + 1]:
		flag = i
		break
if flag == -1:
	flag = n - 1
b = ''
for i in range(n):
	if i != flag:
		b = b + str(a[i])
print(b)


def solve(string):
	for i in range(0, len(string) - 1):
		if string[i] > string[i + 1]:
			return string[:i] + string[i + 1:]
	return string[:-1]
n = int(input())
string = input()[:n]
print(solve(string))


l = int(input())
st = list(input())
mn = ord(st[1]) - 97
mxi = 0
tk = 1
i = 0
s = True
while i < len(st) - 1:
	if ord(st[i]) > ord(st[i + 1]):
		s = False
		break
	i += 1
if s:
	i = len(st) - 1
print(''.join(st[:i] + st[i + 1:]))


import sys

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

def in1():
	return int(input())
n = in1()
a = str(input())
a1 = list(a)
b = []
j = -1
p = 0
for i in range(len(a1)):
	if j > ord(a1[i]):
		a1.pop(i - 1)
		p = 1
		break
	else:
		j = ord(a1[i])
if p == 1:
	print(''.join(a1))
else:
	a1.pop(len(a1) - 1)
	print(''.join(a1))


n = int(input())
s = input()
f = 1
for i in range(n - 1):
	if ord(s[i]) > ord(s[i + 1]) and f:
		f = 0
		pass
	else:
		print(s[i], end='')
if f == 0:
	print(s[i + 1])


n = int(input())
string = input()
flag = 1
for i in range(n - 1):
	if string[i] > string[i + 1]:
		flag = 0
		break
if flag == 1:
	i = n - 1
for j in range(n):
	if i != j:
		print(string[j], end='')


n = int(input())
arr = input()
ans = True
for i in range(n):
	try:
		if ans and arr[i] > arr[i + 1]:
			ans = False
		else:
			print(arr[i], end='')
	except Exception as e:
		pass


import sys
n = int(sys.stdin.readline())
arr = list(sys.stdin.readline().rstrip())
idx = -1
for i in range(n - 1):
	if ord(arr[i]) > ord(arr[i + 1]):
		idx = i
		break
arr[idx] = ''
print(''.join(arr))


n = int(input())
s = list(input())
for r in range(len(s) - 1):
	if s[r] > s[r + 1]:
		del s[r]
		break
	if r == len(s) - 2:
		del s[r + 1]
		break
print(''.join((m for m in s)))


num1 = int(input())
str1 = input().strip()
q = ''
for i in range(len(str1) - 1):
	if str1[i] > str1[i + 1]:
		q = str1[0:i] + str1[i + 1:]
		break
if q != '':
	print(q)
else:
	print(str1[0:-1])


n = input()
s = input()
minimum = s[:-1]
for i in range(0, len(s) - 1):
	if s[i] > s[i + 1]:
		minimum = s[:i] + s[i + 1:]
		break
print(minimum)


def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
n = ii()
s = input().strip()
i = 0
while i < n - 1:
	if ord(s[i]) > ord(s[i + 1]):
		break
	i += 1
ans = s[:i] + s[i + 1:]
print(ans)


import sys
n = int(input())
s = input()
for i in range(n - 1):
	if s[i] > s[i + 1]:
		print(s[:i], s[i + 1:], sep='')
		sys.exit()
print(s[:-1])


t = int(input())
b = input()
c = []
for j in range(t):
	c.append(b[j])
f = 0
for j in range(t - 1):
	if ord(b[j + 1]) < ord(b[j]) and f == 0:
		f = 1
		c[j] = ''
	else:
		pass
if f == 1:
	print(''.join(c))
else:
	c.pop()
	print(''.join(c))


n = int(input())
s = input()
m = s[0]
j = -1
for i in range(len(s) - 1):
	if s[i + 1] < s[i]:
		j = i
		break
if j == -1:
	print(s[:-1])
else:
	print(s[:j] + s[j + 1:])


n = int(input())
a = input()
b = ''
flag = True
i = 1
j = -1
while i <= len(a) - 1:
	if ord(a[i - 1]) > ord(a[i]):
		j = i - 1
		flag = False
		break
	i += 1
if flag:
	print(a[:-1])
else:
	for i in range(len(a)):
		if i == j:
			continue
		else:
			b = b + a[i]
	print(b)


import itertools as it
import functools
import operator
import collections
import math
import sys

def solve(s):
	idx = len(s) - 1
	for (i, (c1, c2)) in enumerate(zip(s, s[1:])):
		if c1 > c2:
			idx = i
			break
	return s[:idx] + s[idx + 1:]

def main():
	n = int(input())
	s = input().strip()
	assert len(s) == n
	result = solve(s)
	print(result)
main()


n = int(input())
s = input()
for i in range(n - 1):
	if s[i] > s[i + 1]:
		print(s[:i] + s[i + 1:])
		quit()
print(s[:-1])


lenght_s = int(input())
s = input()
tracking_index = 0
for i in range(lenght_s):
	tracking_index = i
	if i == lenght_s - 1:
		break
	if s[i] > s[i + 1]:
		break
if tracking_index != lenght_s - 1:
	print(s[:tracking_index] + s[tracking_index + 1:])
else:
	print(s[:-1])


n = int(input())
l = input()
if n > 2:
	p = n
	for i in range(1, n):
		if l[i] < l[i - 1]:
			p = i
			break
	print(l[:p - 1] + l[p:])
else:
	print(min(l))


from sys import stdin, stdout
import cProfile, math
from collections import Counter
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
printHeap = str()
memory_constrained = False
P = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10000000)

class Operation:

	def __init__(self, name, function, function_on_equal, neutral_value=0):
		self.name = name
		self.f = function
		self.f_on_equal = function_on_equal

def add_multiple(x, count):
	return x * count

def min_multiple(x, count):
	return x

def max_multiple(x, count):
	return x
sum_operation = Operation('sum', sum, add_multiple, 0)
min_operation = Operation('min', min, min_multiple, 1000000000.0)
max_operation = Operation('max', max, max_multiple, -1000000000.0)

class SegmentTree:

	def __init__(self, array, operations=[sum_operation, min_operation, max_operation]):
		self.array = array
		if type(operations) != list:
			raise TypeError('operations must be a list')
		self.operations = {}
		for op in operations:
			self.operations[op.name] = op
		self.root = SegmentTreeNode(0, len(array) - 1, self)

	def query(self, start, end, operation_name):
		if self.operations.get(operation_name) == None:
			raise Exception('This operation is not available')
		return self.root._query(start, end, self.operations[operation_name])

	def summary(self):
		return self.root.values

	def update(self, position, value):
		self.root._update(position, value)

	def update_range(self, start, end, value):
		self.root._update_range(start, end, value)

	def __repr__(self):
		return self.root.__repr__()

class SegmentTreeNode:

	def __init__(self, start, end, segment_tree):
		self.range = (start, end)
		self.parent_tree = segment_tree
		self.range_value = None
		self.values = {}
		self.left = None
		self.right = None
		if start == end:
			self._sync()
			return
		self.left = SegmentTreeNode(start, start + (end - start) // 2, segment_tree)
		self.right = SegmentTreeNode(start + (end - start) // 2 + 1, end, segment_tree)
		self._sync()

	def _query(self, start, end, operation):
		if end < self.range[0] or start > self.range[1]:
			return None
		if start <= self.range[0] and self.range[1] <= end:
			return self.values[operation.name]
		self._push()
		left_res = self.left._query(start, end, operation) if self.left else None
		right_res = self.right._query(start, end, operation) if self.right else None
		if left_res is None:
			return right_res
		if right_res is None:
			return left_res
		return operation.f([left_res, right_res])

	def _update(self, position, value):
		if position < self.range[0] or position > self.range[1]:
			return
		if position == self.range[0] and self.range[1] == position:
			self.parent_tree.array[position] = value
			self._sync()
			return
		self._push()
		self.left._update(position, value)
		self.right._update(position, value)
		self._sync()

	def _update_range(self, start, end, value):
		if end < self.range[0] or start > self.range[1]:
			return
		if start <= self.range[0] and self.range[1] <= end:
			self.range_value = value
			self._sync()
			return
		self._push()
		self.left._update_range(start, end, value)
		self.right._update_range(start, end, value)
		self._sync()

	def _sync(self):
		if self.range[0] == self.range[1]:
			for op in self.parent_tree.operations.values():
				current_value = self.parent_tree.array[self.range[0]]
				if self.range_value is not None:
					current_value = self.range_value
				self.values[op.name] = op.f([current_value])
		else:
			for op in self.parent_tree.operations.values():
				result = op.f([self.left.values[op.name], self.right.values[op.name]])
				if self.range_value is not None:
					bound_length = self.range[1] - self.range[0] + 1
					result = op.f_on_equal(self.range_value, bound_length)
				self.values[op.name] = result

	def _push(self):
		if self.range_value is None:
			return
		if self.left:
			self.left.range_value = self.range_value
			self.right.range_value = self.range_value
			self.left._sync()
			self.right._sync()
			self.range_value = None

	def __repr__(self):
		ans = '({}, {}): {}\n'.format(self.range[0], self.range[1], self.values)
		if self.left:
			ans += self.left.__repr__()
		if self.right:
			ans += self.right.__repr__()
		return ans

def display(string_to_print):
	stdout.write(str(string_to_print) + '\n')

def primeFactors(n):
	factors = dict()
	for i in range(2, math.ceil(math.sqrt(n)) + 1):
		while n % i == 0:
			if i in factors:
				factors[i] += 1
			else:
				factors[i] = 1
			n = n // i
	if n > 2:
		factors[n] = 1
	return factors

def isprime(n):
	if n < 4:
		return True
	if n % 2 == 0:
		return False
	if n % 3 == 0:
		return False
	i = 5
	w = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += w
		w = 6 - w
	return True

def test_print(*args):
	if test:
		print(args)

def display_list(list1, sep=' '):
	stdout.write(sep.join(map(str, list1)) + '\n')

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))
memory = dict()

def clear_cache():
	global memory
	memory = dict()

def cached_fn(fn, *args):
	global memory
	if args in memory:
		return memory[args]
	else:
		result = fn(*args)
		memory[args] = result
		return result
TestCases = False
test = False

def main():
	input()
	st = list(input())
	a = st[0]
	for i in range(len(st)):
		if st[i] < a:
			st.pop(i - 1)
			display_list(st, '')
			return
		a = st[i]
	display_list(st[:len(st) - 1], '')
if TestCases:
	for _ in range(get_int()):
		cProfile.run('main()') if test else main()
else:
	cProfile.run('main()') if test else main()


(l, s) = (int(input()), input())
for x in range(l - 1):
	if s[x] > s[x + 1]:
		print(s[:x] + s[x + 1:])
		break
else:
	print(s[:-1])


from sys import stdin, stdout
from math import *

def main():
	n = int(stdin.readline())
	s = stdin.readline()
	c = s[0]
	if s == [c] * n:
		stdout.write(s[1:])
		return 0
	dec = False
	for i in range(1, n):
		if s[i - 1] > s[i]:
			s = s[:i - 1] + s[i:]
			dec = True
			break
	if dec == False:
		s = s[:n - 1]
	stdout.write(s)
	return 0
main()


import sys, math

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

def main():
	n = int(input())
	a = input()
	for i in range(len(a) - 1):
		if a[i] > a[i + 1]:
			print(a[:i] + a[i + 1:])
			return
	print(a[:len(a) - 1])
main()


n = int(input())
s = list(input())
f = False
for i in range(n - 1):
	if s[i] > s[i + 1]:
		s.pop(i)
		f = True
		break
if not f:
	s.pop(n - 1)
print(''.join(s))


n = int(input())
s1 = list(input())
s2 = s1[:]
sw = 0
for i in range(len(s1) - 1):
	if s1[i] > s2[i + 1]:
		s1.pop(i)
		sw = 1
if not sw:
	s1.pop(-1)
print(''.join(s1))


n = int(input())
s = str(input())
index = n - 1
for i in range(1, n):
	if s[i - 1] > s[i]:
		index = i - 1
		break
newstr = s[:index] + s[index + 1:]
print(newstr)


n = int(input())
s = input()
answer = s
edited = False
for i in range(n - 1):
	if s[i + 1] < s[i]:
		answer = s[:i] + s[i + 1:]
		edited = True
		break
if not edited:
	answer = s[:n - 1]
print(answer)


a = int(input())
s = input()
co = 1
while co <= a - 1 and s[co - 1] <= s[co]:
	co += 1
print(s[:co - 1] + s[co:])


n = int(input())
string = str(input())
pos = len(string) - 1
for i in range(len(string) - 1):
	if string[i] > string[i + 1]:
		pos = i
		break
print(string[:pos] + string[pos + 1:])


n = int(input())
s = input()
ma = 'a'
st = []
t = False
if n == 1:
	print(s)
else:
	for i in range(1, len(s)):
		if s[i - 1] > s[i] and (not t):
			ma = s[i - 1]
			t = True
	k = 0
	if not t:
		ma = s[len(s) - 1]
	for i in s:
		if i != ma:
			print(i, end='')
		elif k != 0:
			print(i, end='')
		elif i == ma:
			k += 1


t = int(input())
l = list(input())
flag = 0
for j in range(1, len(l)):
	if ord(l[j]) < ord(l[j - 1]):
		l.pop(j - 1)
		flag = 1
		break
if flag == 0:
	print(*l[0:-1], sep='')
else:
	print(*l, sep='')


import sys
n = int(sys.stdin.readline())
s = sys.stdin.readline()
t = list(s)
isbreak = 0
for i in range(n - 1):
	if s[i] > s[i + 1]:
		t.pop(i)
		isbreak = 1
		break
print(''.join(t) if isbreak == 1 else ''.join(t[:-2]))


n = int(input())
s = input()
for i in range(n - 1):
	if s[i] > s[i + 1]:
		print(s[:i] + s[i + 1:])
		return
print(s[:n - 1])


n = int(input())
m = input()
p_i = 'a'
ans = m[:-1]
for i in range(n):
	if ord(p_i) > ord(m[i]):
		ans = m[:i - 1] + m[i:]
		break
	p_i = m[i]
print(ans)


n = eval(input())
s = input()
k = ''
a = -1
for i in range(n - 1):
	if s[i] > s[i + 1]:
		k = s[:i]
		a = i
		k = k + s[i + 1:]
		break
if a == -1:
	k = s[:-1]
print(k)


N = int(input())
s = input()
answer = s[:-1]
for i in range(len(s) - 1):
	if ord(s[i + 1]) < ord(s[i]):
		answer = s[:i] + s[i + 1:]
		break
print(answer)


a = int(input())
str_ = input()
str_list = list(str_)
for i in range(0, a - 1):
	if str_list[i] > str_list[i + 1]:
		del str_list[i]
		break
if len(str_list) < a:
	print(''.join(str_list))
else:
	print(''.join(str_list[0:-1]))


n = input()
s = input()
k = int(n) - 1
new = ''
for i in range(int(n) - 1):
	if ord(s[i]) > ord(s[i + 1]):
		k = i
		break
for i in range(int(n)):
	if i != k:
		new = new + s[i]
print(new)


m = int(input())
n = input()
n = list(n)
flag = 0
l = n
maxi = ord(l[0])
ind = 0
for i in range(1, len(n)):
	if ord(n[i]) < ord(n[i - 1]):
		n.pop(i - 1)
		print(''.join(n))
		flag = 1
		break
if flag == 0:
	for j in range(0, len(l)):
		if ord(l[i]) > maxi:
			maxi = ord(l[i])
			ind = i
	l.pop(ind)
	print(''.join(l))


n = int(input())
s = input()
l = list(s)
f = 0
c = n - 1
for i in range(1, n):
	if l[i - 1] > l[i]:
		c = i - 1
		break
l.pop(c)
print(''.join(l))


n = int(input())
a = list(input())
for i in range(n - 1):
	if a[i] > a[i + 1]:
		print(''.join(a[:i] + a[i + 1:]))
		break
else:
	print(''.join(a[:-1]))


n = int(input())
s = input()
for (i, c) in enumerate(s):
	if i < len(s) - 1:
		if c > s[i + 1]:
			min_s = s[:i] + s[i + 1:]
			break
	else:
		min_s = s[:i]
print(min_s)


import sys
input = sys.stdin.readline
n = int(input())
s = list(input())
l = 0
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		k = i
		l += 1
		break
if l == 1:
	print(''.join(s[:i] + s[i + 1:]))
else:
	print(''.join(s[:s.index(max(s))] + s[s.index(max(s)):]))


import sys
import math
import bisect

def solve(s):
	n = len(s)
	for i in range(n - 1):
		if s[i + 1] < s[i]:
			return s[0:i] + s[i + 1:]
	return s[:-1]

def main():
	n = int(input())
	s = input()
	ans = solve(s)
	print(ans)
main()


n = int(input())
a = input()
for i in range(n - 1):
	if ord(a[i]) > ord(a[i + 1]):
		print(a[:i] + a[i + 1:])
		return
print(a[:n - 1])


input()
s = input()
bo = False
for i in range(1, len(s)):
	if s[i] < s[i - 1]:
		print(s[:i - 1] + s[i:])
		exit(0)
print(s[:-1])


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
n = int(input())
s = str(input())
ind = n
for i in range(n - 1):
	if s[i] <= s[i + 1]:
		continue
	else:
		ind = i
		break
if ind == n:
	print(s[:-1])
else:
	t = ''
	for i in range(n):
		if i != ind:
			t += s[i]
	print(t)
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


n = int(input())
s = input()
i = 0
al = list('abcdefghijklmnopqrstuvwxyz')
while i < n:
	if i == n - 1:
		break
	if al.index(s[i]) > al.index(s[i + 1]):
		break
	i += 1
print(s[:i] + s[i + 1:])


a = int(input())
b = input().replace('', ' ').split()
n = 0
for i in range(1, a):
	if b[i] < b[i - 1]:
		b.pop(i - 1)
		n = 1
		break
if n == 0:
	b.pop()
	print(*b, sep='')
else:
	print(*b, sep='')


length = int(input())
a = list(input())
savedIndex = -1
for i in range(length - 1):
	if a[i] > a[i + 1]:
		savedIndex = i
		break
if savedIndex == -1:
	a.pop()
else:
	a.pop(savedIndex)
print(''.join(a))


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

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

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))
mo = 1000000007
n = inn()
s = input()
id = -1
for i in range(n - 1):
	if s[i] > s[i + 1]:
		id = i
		break
if id == -1:
	print(s[:n - 1])
else:
	print(s[:id] + s[id + 1:])


length = int(input())
s = input()
del_num = length - 1
for i in range(length - 1):
	if s[i] > s[i + 1]:
		del_num = i
		break
new_s = ''
for i in range(length):
	if i != del_num:
		new_s = new_s + s[i]
print(new_s)


n = int(input())
s = input()
ar = list(s)
t = max(ar)
for i in range(1, n):
	if ar[i] < ar[i - 1]:
		t = ar[i - 1]
		break
ar.remove(t)
print(''.join(ar))


def minimization(s):
	pos = len(s) - 1
	for i in range(len(s)):
		if i + 1 < len(s) and s[i] > s[i + 1]:
			pos = i
			break
	return s[0:pos] + s[pos + 1:]
n = int(input())
t = input()
print(minimization(t))


length = int(input())
text = input()
i = 0
found = False
for i in range(length - 1):
	if text[i] > text[i + 1]:
		found = True
		break
if i == length - 2 and (not found):
	print(text[:-1])
else:
	print(text[:i] + text[i + 1:])


n = int(input())
s = input()
latin = {}
for (i, ch) in enumerate(list('abcdefghijklmnopqrstuvwxyz')):
	latin[ch] = i
last_ch = s[0]
for (i, ch) in enumerate(s[1:]):
	if latin[ch] < latin[last_ch]:
		print(s[:i] + s[i + 1:])
		break
	last_ch = ch
else:
	print(s[:-1])


n = int(input())
s = input()
res = ''
pos = -1
i = 0
while i < n - 1:
	if s[i] > s[i + 1]:
		pos = i
		break
	i += 1
if pos == -1:
	print(s[:-1])
else:
	print(s[:pos] + s[pos + 1:])


n = int(input())
s = input()
a = ''
count = 0
for i in range(len(s) - 1):
	if s[i] > s[i + 1] and count == 0:
		count += 1
	else:
		a += s[i]
if count == 0:
	print(a)
else:
	print(a + s[-1])


n = int(input())
a = input()
for i in range(n - 1):
	if a[i] > a[i + 1]:
		print(a[:i], a[i + 1:], sep='')
		break
else:
	print(a[:-1])


x = int(input())
s = input()
d = False
for i in range(x - 1):
	if s[i] > s[i + 1]:
		s = s.replace(s[i], '', 1)
		d = True
		break
if d == False:
	s = s.replace(s[x - 1], '', 1)
print(s)


n = int(input())
arr = input()
maxi = -1
for i in range(n - 1):
	if ord(arr[i]) - ord(arr[i + 1]) > 0:
		maxi = i
		break
if maxi == -1:
	print(arr[:n - 1])
	exit()
print(arr[:maxi] + arr[maxi + 1:])


x = input()
s = input()
i = 0
while i + 1 < len(s) and s[i] <= s[i + 1]:
	i += 1
print(s[:i] + s[i + 1:])


n = input()
s = list(input())
for (count, item) in enumerate(s):
	if s[count] > s[count + 1]:
		s = s[:count] + s[count + 1:]
		break
	if count == len(s) - 2:
		s = s[:-1]
		break
s = ''.join(s)
print(s)


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
n = ii1()
s = list(is1())
for i in range(n - 1):
	if s[i] > s[i + 1]:
		s.pop(i)
		print(''.join(s))
		break
else:
	print(''.join(s[:-1]))


n = int(input())
s = input()
l = list(s)
greatest = l[0]
for i in range(n - 1):
	if l[i] > l[i + 1]:
		l.remove(l[i])
		break
	greatest = l[i + 1]
if len(l) == n:
	l.remove(greatest)
print(''.join(l))


def print_ans(string):
	print(''.join(list(map(chr, string))))
	quit(0)
l_data = int(input())
data = list(map(ord, list(input())))
for i in range(1, l_data):
	if data[i - 1] > data[i]:
		data.pop(i - 1)
		print_ans(data)
		break
else:
	data.pop(-1)
	print_ans(data)


n = int(input())
s = input()
s = list(s)
y = min(s)
c = []
x = set(s)
for i in x:
	c.append(s.index(i))
c.sort()
mins = s
for i in c:
	k = s[:i] + s[i + 1:]
	if k < mins:
		mins = k
s = ''
for i in mins:
	s += i
print(s)


n = int(input())
a = input()
A = [ch for ch in a]
remove = -1
for i in range(n - 1):
	if ord(A[i]) > ord(A[i + 1]):
		remove = i
		break

def removal(a, k):
	return ''.join([a[i] for i in range(len(a)) if i != k])
if remove == -1:
	print(a[:-1])
else:
	print(removal(a, remove))


def trim(mystr):
	if mystr is None:
		return
	flag = False
	my = list(mystr)
	for i in range(len(my) - 1):
		if my[i] > my[i + 1]:
			my[i] = '$'
			flag = True
			break
	if not flag:
		res = my[:-1]
		print(''.join(res))
	else:
		for c in my:
			if c != '$':
				print(c, end='')
a = int(input())
trim(str(input()))


n = int(input())
s = list(input())
ans = n - 1
for i in range(n - 1):
	if s[i] > s[i + 1]:
		ans = i
		break
s[ans] = ''
print(''.join(s))


n = int(input())
s = str(input())
i = 0
while i < n - 1:
	if ord(s[i + 1]) < ord(s[i]):
		new = s[0:i] + s[i + 1:n]
		break
	else:
		i = i + 1
		continue
if i == n - 1:
	new = s[0:n - 1]
print(new)


n = int(input())
s = list(input())
flag = False
for i in range(n - 1):
	if s[i] > s[i + 1]:
		s.pop(i)
		for c in s:
			print(c, end='')
		flag = True
		break
if not flag:
	s.pop()
	for c in s:
		print(c, end='')


n = int(input())
a = list(input()) + ['@']
for i in range(n):
	if a[i] > a[i + 1]:
		del a[i]
		break
print(*a[:-1], sep='')


from sys import stdin

def main():
	n = int(input())
	s = input().strip()
	j = n - 1
	for i in range(n - 1):
		if s[i] > s[i + 1]:
			j = i
			break
	ans = s[:j] + s[j + 1:]
	print(ans)
	return
main()


n = int(input())
s = input()
ans = ''
flag = 0
for i in range(n - 1):
	if s[i] > s[i + 1]:
		ans = s[:i] + s[i + 1:]
		flag = 1
		break
if flag == 0:
	print(s[:n - 1])
else:
	print(ans)


input()
napis = input()
for i in range(len(napis)):
	if i > 0:
		if napis[i] < napis[i - 1]:
			napis = napis[:i - 1] + napis[i:]
			break
	if i == len(napis) - 1:
		napis = napis[:-1]
print(napis)


n = int(input())
s = list(input())
can = False
for i in range(n - 1):
	if s[i] > s[i + 1]:
		s.pop(i)
		can = True
		break
if not can:
	s.pop()
print(*s, sep='')


n = int(input())
s = input()
p = len(s) - 1
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		p = i
		break
print(s[0:p] + s[p + 1:])


import sys
input = sys.stdin.readline
import math

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
input()
s = insr()
pos = -1
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		pos = i
		break
if pos == -1:
	print(''.join(s[:len(s) - 1]))
else:
	print(''.join(s[:pos]) + ''.join(s[pos + 1:]))


n = int(input())
S = input()
for _ in range(n - 1):
	if S[_] > S[_ + 1]:
		print(S[:_] + S[_ + 1:])
		break
else:
	print(S[:-1])


n = int(input())
s = list(input())
for i in range(1, n):
	if s[i] < s[i - 1]:
		del s[i - 1]
		break
else:
	del s[-1]
print(*s, sep='')


input()
s = list(input())
removed = False
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		del s[i]
		removed = True
		break
if not removed:
	del s[-1]
print(''.join(s))


n = int(input())
s = input()
i = 1
while i < n:
	if ord(s[i]) < ord(s[i - 1]):
		break
	i += 1
if i == n:
	print(s[:n - 1])
else:
	print(s[:i - 1] + s[i:])


def main():
	input()
	x = input()
	if len(x) == 2:
		print(min(x[0], x[1]))
	else:
		x = list(x)
		naik = None
		for i in range(len(x) - 1):
			if x[i] > x[i + 1]:
				del x[i]
				print(''.join(x))
				return 0
		print(''.join(x[:-1]))
main()


n = int(input())
arr = input()
ans = ''
f = 0
for i in range(n - 1):
	if arr[i] <= arr[i + 1]:
		ans += arr[i]
	elif f == 1:
		ans += arr[i]
	else:
		f = 1
if len(ans) == n - 2:
	ans += arr[n - 1]
print(ans)


n = int(input())
words = input()
t = 1
for i in range(1, n):
	if words[i] < words[i - 1]:
		break
	else:
		t += 1
if t == n:
	new_words = words[:n - 1]
else:
	new_words = words[:i - 1] + words[i:]
print(new_words)


n = int(input())
(s, i) = (input(), 0)
alpha = 'abcdefghijklmnopqrstuvwxyz'
while i < n - 1 and s[i] <= s[i + 1]:
	i += 1
if i == n - 1:
	print(s[0:n - 1])
else:
	print(s[0:i], s[i + 1:], sep='')


n = int(input())
s = input()
alth = 'abcdefghijklmnopqrstuvwxyz'
ans = n - 1
for i in range(1, n):
	if alth.find(s[i]) < alth.find(s[i - 1]):
		ans = i - 1
		break
for i in range(n):
	if i != ans:
		print(s[i], end='')


n = int(input())
s = input()
max = 0
num = 0
for i in range(n - 1):
	if s[i] > s[i + 1]:
		print(s[:i] + s[i + 1:])
		exit()
print(s[:-1])


import sys

def rint():
	return map(int, sys.stdin.readline().split())
n = int(input())
s = list(input())
d = -1
for i in range(0, n - 1):
	if s[i] > s[i + 1]:
		d = i
		break
else:
	d = n - 1
if d == n - 1:
	ss = s[:d]
else:
	ss = s[:d] + s[d + 1:]
print(''.join(ss))


n = int(input())
s = input()
j = 0
for i in range(1, n):
	if s[i] < s[i - 1]:
		j = i - 1
		break
ans = s[:j] + s[j + 1:]
if ans > s[:n - 1]:
	ans = s[:n - 1]
print(ans)


import sys
lines = []
for line in sys.stdin:
	lines.append(line.rstrip('\n'))
size = int(lines.pop(0))
aString = lines.pop(0)

def stringWithoutCharacter(aString, index):
	return aString[0:index] + aString[index + 1:len(aString)]
for i in range(0, len(aString)):
	if i + 1 >= len(aString):
		break
	if aString[i + 1] < aString[i]:
		break
print(stringWithoutCharacter(aString, i))


import sys
import math
import itertools
import collections

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

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

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return '\n'.join(map(str, arr))

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
n = ii()
s = input()
pos = i = 0
while i < n - 1:
	if s[i] > s[i + 1]:
		pos = i
		break
	i += 1
if pos == 0 and i == n - 1:
	print(s[:n - 1])
elif pos == 0 and i == 0:
	print(s[1:])
else:
	print(s[:pos] + s[pos + 1:])


n = input()
s = input()
r = 0
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		r = i
		break
else:
	r = len(s) - 1
print(s[:r] + s[r + 1:])


from sys import stdout
(n, s, o) = (int(input()), input(), True)
for i in range(n - 1):
	if o and s[i] > s[i + 1]:
		o = False
		continue
	stdout.write(s[i])
if not o or n == 1:
	print(s[-1])
else:
	print()


n = int(input())
s = input()

def mimimi(s, n):
	for i in range(1, n):
		if s[i] < s[i - 1] and i > 1:
			return s[:i - 1] + s[i:]
		elif s[i] < s[i - 1] and i == 1:
			return s[1:]
		elif s[i] < s[i - 1] and i == n - 1:
			return s[:-1]
	return s[:-1]
print(mimimi(s, n))


n = input()
s = input()
for i in range(len(s) - 1):
	if s[i] < s[i + 1]:
		pass
	elif s[i] > s[i + 1]:
		s = s[:i] + s[i + 1:]
		break
else:
	s = s[:len(s) - 1] + s[len(s):]
print(s)


n = int(input())
a = input()
A = []
for i in range(0, n):
	A.append(ord(a[i]))
s = len(a)
n = max(A)
l = chr(n)
b = a
index = 0
for i in range(0, len(A) - 1):
	if A[i] > A[i + 1]:
		b = a[:i] + a[i + 1:s]
		break
if b == a:
	b = a[0:s - 1]
print(b)


def main():
	n = int(input())
	s = list(input())
	for i in range(n - 1):
		if s[i + 1] < s[i]:
			s[i] = ''
			break
	else:
		s[n - 1] = ''
	print(*s, sep='')
main()


while True:
	try:

		def solution(n):
			s = input()
			ind = n - 1
			for i in range(n - 1):
				t = ord(s[i])
				t1 = ord(s[i + 1])
				if t > t1:
					ind = i
					break
			s = list(s)
			del s[ind]
			print(''.join(s))
		if __name__ == '__main__':
			n = int(input())
			solution(n)
	except EOFError:
		break


from sys import stdin

def main():
	N = int(input())
	S = input()
	for i in range(N - 1):
		if S[i] > S[i + 1]:
			print(S[:i] + S[i + 1:])
			break
	else:
		print(S[:-1])
input = lambda : stdin.readline().rstrip()
main()


N = int(input())
S = input()
tam = len(S)
S += chr(ord(S[tam - 1]) + 1)
for pos in range(tam):
	if S[pos] > S[pos + 1]:
		break
ans = S[0:pos] + S[pos + 1:tam]
print(ans)


import sys
input = sys.stdin.readline
n = int(input())
s = input()
cur = 0
f = False
for i in range(n - 1):
	if ord(s[i + 1]) < ord(s[i]):
		f = True
		cur = i
		break
if not f:
	print(s[:n - 1])
else:
	print(s[:cur] + s[cur + 1:])


n = int(input())
s = list(input())
nd = 0
for i in range(0, n - 1):
	if s[i] > s[i + 1]:
		s = s[0:i] + s[i + 1:]
		print(''.join(s))
		nd = 1
		break
if nd == 0:
	print(''.join(s[:-1]))


n = int(input())
s = input()
for i in range(len(s)):
	if i < n - 1 and ord(s[i]) > ord(s[i + 1]):
		if i == 0:
			print(s[i + 1:])
			break
		else:
			print(s[:i] + s[i + 1:])
			break
	elif i == n - 1:
		print(s[:n - 1])
		break


n = int(input())
s = input()
pos = -1
for i in range(len(s) - 1):
	if s[i] > s[i + 1]:
		for j in range(len(s)):
			if j != i:
				print(s[j], end='')
		exit(0)
print(s[:-1])


n = int(input())
s = input()
alphabet = ['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']
if n == 1:
	print(s)
else:
	for i in range(n - 1):
		if alphabet.index(s[i + 1]) < alphabet.index(s[i]):
			a = i
			break
		else:
			a = n - 1
	word = list(s)
	word.pop(a)
	word = ''.join(word)
	print(word)


t = int(input())
s = input()
n = len(s)
counter = 0
j = 0
for i in range(n):
	if i + 1 > n - 1 and counter == 0:
		j = i + 1
		break
	if s[i] > s[i + 1]:
		j = i + 1
		counter += 1
		break
print(s[0:j - 1] + s[j:n])


import sys
n = int(input())
s = input()
for i in range(len(s) - 1):
	if ord(s[i]) > ord(s[i + 1]):
		print(s[:i] + s[i + 1:])
		sys.exit()
print(s[:-1])


n = int(input())
s = input()
cur = -1
for i in range(n - 2, -1, -1):
	if s[i] > s[i + 1]:
		cur = i
if cur == -1:
	print(s[:n - 1])
else:
	print(s[:cur] + s[cur + 1:])


class CodeforcesTask1076ASolution:

	def __init__(self):
		self.result = ''
		self.str_len = 0
		self.word = ''

	def read_input(self):
		self.str_len = int(input())
		self.word = input()

	def process_task(self):
		w_ords = [ord(c) for c in self.word]
		to_rm = self.str_len - 1
		for x in range(self.str_len - 1):
			if w_ords[x] > w_ords[x + 1]:
				to_rm = x
				break
		self.result = self.word.replace(self.word[to_rm], '', 1)

	def get_result(self):
		return self.result
Solution = CodeforcesTask1076ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = int(input())
s = input()
i = 0
for j in range(n + 1):
	i = j
	if i < n - 1:
		if s[i] > s[i + 1]:
			break
	else:
		break
for j in range(n):
	if j != i:
		print(s[j], end='')


n = int(input())
s = input()
index = n - 1
for (ind, i) in enumerate(s[:-1]):
	if s[ind] > s[ind + 1]:
		index = ind
		break
print(s[:index] + s[index + 1:])


import math, sys, bisect, heapq
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
int1 = lambda x: int(x) - 1
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))
ilelec = lambda : map(int1, input().split())
alelec = lambda : list(map(int1, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])
n = int(input())
s = input()
for i in range(n - 1):
	if s[i] > s[i + 1]:
		print(s[:i] + s[i + 1:])
		exit(0)
print(s[:n - 1])


n = int(input())
word = input()
stop = False
for i in range(0, n - 1):
	if word[i] > word[i + 1]:
		stop = True
		ans = word[:i] + word[i + 1:]
		break
if stop == True:
	print(ans)
else:
	print(word[:-1])


n = int(input())
s = list(input())
b = False
for x in range(0, len(s) - 1, +1):
	if s[x] > s[x + 1]:
		del s[x]
		b = True
		break
if b == True:
	print(''.join(s))
else:
	del s[-1]
	print(''.join(s))


(n, str) = (int(input()), input())
for i in range(n - 1):
	if str[i] > str[i + 1]:
		print(str[0:i] + str[i + 1:n])
		quit()
print(str[0:n - 1])


n = int(input())
l = list(input())
a = 0
done = 0
for i in range(n - 1):
	if ord(l[i]) > ord(l[i + 1]):
		a = i
		done = 1
		break
if done == 1:
	l.pop(a)
else:
	l.pop(n - 1)
print(''.join(l))


import sys
n = int(input())
s = input()
res = ''
for i in range(n - 1):
	if s[i] > s[i + 1]:
		res = s[0:i] + s[i + 1:]
		print(res)
		sys.exit()
print(s[:-1])


a = input()
a = int(a)
b = input()
c = 0
for i in range(a):
	try:
		if b[i + 1] < b[i]:
			for j in range(i + 1, a):
				print(b[j], end='')
			break
		else:
			print(b[i], end='')
	except:
		pass


n = int(input())
s = input()
f = True
for i in range(n - 1):
	if s[i] > s[i + 1]:
		f = False
		break
if f:
	print(s[:-1])
else:
	print(s[:i] + s[i + 1:])


import sys
input = sys.stdin.readline
n = int(input())
s = list(input().rstrip())
z = n - 1
for i in range(n - 1):
	if s[i] > s[i + 1]:
		z = i
		break
print(''.join(s[:z] + s[z + 1:]))


n = int(input())
a = input()
c = 'a'
l = []
f = 0
for i in range(n):
	if f == 0:
		if c > a[i]:
			f = 1
		else:
			c = a[i]
	l.append(a[i])
l.remove(c)
for i in range(n - 1):
	print(l[i], end='')


n = int(input())
a = input()
done = False
for i in range(n - 1):
	if a[i] > a[i + 1]:
		print(a[0:i] + a[i + 1:n])
		done = True
		break
if not done:
	print(a[:-1])


a = int(input())
b = input()
for i in range(1, a):
	if b[i] < b[i - 1]:
		print(b[:i - 1] + b[i:])
		exit()
print(b[:a - 1])


def test_1():
	import math
	from collections import Counter
	n = list(map(int, input().split(' ')))[0]
	ss = input()
	idx = n - 1
	for i in range(n - 1):
		if ss[i] > ss[i + 1]:
			idx = i
			break
	dd = ss.replace(ss[idx], '', 1)
	print(dd)
test_1()


t = int(input())
s = input()
i = 1
a = [None] * t
p = True
temp = 0
while p and i < t:
	if s[i] < s[i - 1]:
		p = False
		temp = i - 1
	elif s[i] > s[i - 1]:
		i += 1
		temp = i - 1
	elif s[i] == s[i - 1]:
		i += 1
a = list(s)
a.pop(temp)
print(*a, sep='')


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

def read_int():
	return int(stdin.readline())

def read_ints():
	return [int(x) for x in stdin.readline().split()]

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
lens = read_int()
strs = read_str()
ans = ''
for i in range(lens - 1):
	if strs[i] > strs[i + 1]:
		ans = strs[:i] + strs[i + 1:]
		break
if ans == '':
	ans = strs[:-1]
print(ans)


n = int(input())
c = input()
ans = ''
for i in range(n - 1):
	if c[i] <= c[i + 1]:
		ans += c[i]
	else:
		ans = ans + c[i + 1:]
		break
print(ans)


N = int(input())
s = input()
pre = s[0]
for i in range(1, N):
	if pre > s[i]:
		print(min(s, s[:i - 1] + s[i:]))
		exit()
	else:
		pre = s[i]
print(min(s, s[:-1]))


n = int(input())
s = list(input())
maxi = []
maxi.append([0, s[0]])
maxi.append(-1)
for i in range(1, n):
	if s[i] > maxi[0][1]:
		maxi[0] = [i, s[i]]
	if s[i - 1] > s[i]:
		if maxi[1] == -1:
			maxi[1] = i - 1
ans1 = s.copy()
ans2 = s.copy()
ans1.pop(maxi[0][0])
ans2.pop(maxi[1])
ans1 = ''.join(ans1)
ans2 = ''.join(ans2)
print(ans1 if ans1 < ans2 else ans2)


from sys import stdin, stdout
n = int(stdin.readline().strip())
s = stdin.readline().strip()
for i in range(n - 1):
	if s[i] > s[i + 1]:
		maxs = s[:i] + s[i + 1:]
		break
else:
	maxs = s[:-1]
stdout.write(maxs + '\n')


n = int(input())
s = input().strip()
index = -1
for i in range(n - 1):
	if ord(s[i]) > ord(s[i + 1]):
		index = i
		break
if index != -1:
	for i in range(index):
		print(s[i], end='')
	for j in range(index + 1, n):
		print(s[j], end='')
else:
	for i in range(n - 1):
		print(s[i], end='')


n = int(input())
s = input()
s = list(s)
for i in range(n - 1):
	if s[i] > s[i + 1]:
		s.remove(s[i])
		break
if len(s) == n:
	s.remove(s[n - 1])
print(''.join(s))


n = int(input())
li = list(input())
m = 0
for i in range(n - 1):
	if li[i] > li[i + 1]:
		li.pop(i)
		m = 1
		break
if m == 0:
	li.pop(-1)
print(''.join(li))


import math
mod = 1000000007

def power(a, b):
	res = 1
	b = b % (mod - 1)
	while b > 0:
		if b % 2 != 0:
			res = res % mod * (a % mod) % mod
		b = b // 2
		a = a % mod
		a = a * a % mod
	res = res % mod
	return res
n = int(input())
a = input()
s = 0
for i in range(n - 1):
	if s == 0 and a[i] > a[i + 1]:
		s = 1
		continue
	print(a[i], end='')
if s == 1:
	print(a[n - 1], end='')