-
Notifications
You must be signed in to change notification settings - Fork 86
/
1076A. Minimizing the String.cpp
70 lines (53 loc) · 1.08 KB
/
1076A. Minimizing the String.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#define _CRT_SECURE_NO_WARNINGS
/***from dust i have come, dust i will be***/
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define dbg printf("in\n");
#define nl printf("\n");
#define N 1010
#define inf 1e18
#define sf(n) scanf("%d", &n)
#define sff(n,m) scanf("%d%d",&n,&m)
#define sfl(n) scanf("%I64d", &n)
#define sffl(n,m) scanf("%I64d%I64d",&n,&m)
#define pf(n) printf("%d",n)
#define pff(n,m) printf("%d %d",n,m)
#define pffl(n,m) printf("%I64d %I64d",n,m)
#define pfl(n) printf("%I64d",n)
#define pfs(s) printf("%s",s)
#define pb push_back
#define pp pair<int,int>
using namespace std;
int main()
{
freopen("in.txt", "r", stdin);
int i,j,k;
int m,n;
string s;
cin>>n;
cin>>s;
k=0;
for(i=0; i<n-1; i++)
{
if(s[i]>s[i+1])
{
s[i]='#';
k=1;
break;
}
}
if(!k)
{
for(i=0;i<n-1;i++)
cout<<s[i];
}
else
{
for(i=0;i<n;i++)
{
if(s[i]!='#'){cout<<s[i];}
}
}
return 0;
}