time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

ou are given a string ss consisting of nn 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=s1s2…sns=s1s2…sn is lexicographically smaller than string t=t1t2…tmt=t1t2…tm if n<mn<m and s1=t1,s2=t2,…,sn=tns1=t1,s2=t2,…,sn=tn or n≥mn≥m and there exists a number pp such that p≤mp≤m and s1=t1,s2=t2,…,sp−1=tp−1s1=t1,s2=t2,…,sp−1=tp−1 and sp<tpsp<tp .

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 nn (2≤n≤2⋅1052≤n≤2⋅105 ) — the length of ss .

The second line of the input contains exactly nn lowercase Latin letters — the string ss .

Output

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

Examples

Input

3
aaa

Output

aa

Input

5
abcda

Output

abca

Note

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

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

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
int n;
cin>>n;
string s;
cin>>s;
int k;
for(int t=0;t<n-1;t++)
{
if(s[t]>s[t+1])
{
k=t;
break;
}
}
for(int t=0;t<n;t++)
{
if(t==k)
{
continue;
}
cout<<s[t];
}
cout<<endl;
return 0;
}

最新文章

  1. Ubuntu菜鸟入门(九)—— 支付宝支付控件安装
  2. 自定义PHP系统异常处理类
  3. 转 - ubuntu apache2下目录结构
  4. JAVA 设计模式 状态模式
  5. [asp.net core]project.json(1)
  6. checkbox的单选全选,反选,计算价格,删除
  7. 我用工具怎么连接不上mysql数据库的? MySql access denied for user错误
  8. JSF 2 dropdown box example
  9. js 的 提交
  10. 阿铭linux笔记
  11. mysql性能优化学习笔记(5)数据库结构优化
  12. 解决不同操作系统下git换行符一致性问题
  13. 为什么不要在viewDidLoad方法中设置开始监听键盘通知
  14. Spring Boot 数据库连接池 Druid
  15. background-clip 和 background-origin 的区别
  16. wifidog源码分析 - 认证服务器心跳检测线程
  17. 2017ACM/ICPC广西邀请赛-重现赛
  18. CM记录-Hadoop参数调优
  19. Oracle 基础学习笔记
  20. 关于TensorFlow多种安装方式

热门文章

  1. DAY20-Django之FileField与ImageField
  2. DHCP工作工程
  3. springmvc 处理器方法返回的是modelandview 重定向到页面
  4. spring----AOP注解以及spring的JDBC和事务
  5. 仿射变换详解 warpAffine
  6. JavaPersistenceWithHibernate第二版笔记-第七章-003Mapping an identifier bag(@OrderColumn、@ElementCollection、@CollectionTable、、)
  7. redhat图形界面启动后出现桌面但是没有登录界面解决办法
  8. SDUT 3398 数据结构实验之排序一:一趟快排
  9. DiscreteFrechetDist
  10. jQuery+css实现tab功能