#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps=1e-8;
int main() {
	ll x[10] = { 0,1,2,3,4,5,6,7,8,9 };
	string s; cin >> s;
	int len = s.length();
	ll ch = 0; ll a = 1;
	per(i, len) {
		ch += (s[i]-'0') * a; a *= (ll)10;
	}
	ll sum = 0; a = (ll)1;
	per(i, len) {
		sum += x[i] * a; a *= (ll)10;
	}
	ll ma = sum; ll z[10] = { 0,1,2,3,4,5,6,7,8,9 };
	while (next_permutation(x, x + 10)) {
		sum = 0; a = 1;
		per(i, len) {
			sum += x[i] * a; a *= 10;
		}
		ll dif;
		if (ch > sum) {
			dif = min(ch - sum, sum + a - ch);
		}
		else {
			dif = min(sum - ch, ch + a - sum);
		}
		if (ma < dif) {
			ma = dif;
			rep(i, 10) {
				z[i] = x[i];
			}
		}
	}
	rep(i,len) {
		cout << z[i];
	}
	cout << endl;
	return 0;
}

### Prompt

Create a solution in Cpp for the following problem:

Example

Input

201


Output

701

### Response

```cpp
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps=1e-8;
int main() {
	ll x[10] = { 0,1,2,3,4,5,6,7,8,9 };
	string s; cin >> s;
	int len = s.length();
	ll ch = 0; ll a = 1;
	per(i, len) {
		ch += (s[i]-'0') * a; a *= (ll)10;
	}
	ll sum = 0; a = (ll)1;
	per(i, len) {
		sum += x[i] * a; a *= (ll)10;
	}
	ll ma = sum; ll z[10] = { 0,1,2,3,4,5,6,7,8,9 };
	while (next_permutation(x, x + 10)) {
		sum = 0; a = 1;
		per(i, len) {
			sum += x[i] * a; a *= 10;
		}
		ll dif;
		if (ch > sum) {
			dif = min(ch - sum, sum + a - ch);
		}
		else {
			dif = min(sum - ch, ch + a - sum);
		}
		if (ma < dif) {
			ma = dif;
			rep(i, 10) {
				z[i] = x[i];
			}
		}
	}
	rep(i,len) {
		cout << z[i];
	}
	cout << endl;
	return 0;
}

```