#include <bits/stdc++.h>
using namespace std;
#define fs first
#define se second
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define pb emplace_back
using pii = pair<int, int>;
using vi = vector<int>;
using lint = long long;
const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, string s = "\n") { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ")
{ rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }
int main() {
int a[3], b[3];
rep(i, 3) scanf("%1d", a + i);
rep(i, 3) scanf("%1d", b + i);
int ans = 0, d = 100;
rep(i, 3) {
ans += (a[i] - b[i]) * d;
d /= 10;
}
int A = 0, B = 0;
d = 100;
rep(i, 3) {
if (a[i] == 9) { d /= 10; continue; }
A = (9 - a[i]) * d;
break;
}
if (b[0] != 1) {
B = (b[0] - 1) * 100;
}
else if (b[1] != 0) {
B = (b[1] * 10);
} else {
B = b[2];
}
cout << ans + max(A, B) << endl;
}
./Main.cpp: In function ‘int main()’:
./Main.cpp:29:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
rep(i, 3) scanf("%1d", a + i);
^
./Main.cpp:30:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
rep(i, 3) scanf("%1d", b + i);
^