/*
project euler problem 4: 找出由两个三位数相乘的最大的回文数。
answer: 906609
*/
#include<bits/stdc++.h>
using namespace std;
bool check(int num)
{
string s = to_string(num);
string t = s;
reverse(t.begin(), t.end());
return s == t;
}
int main(void)
{
int ans = 0;
for (int i = 100; i < 1000; ++i)
for (int j = 100; j < 1000; ++j)
if (check(i * j)) ans = max(ans, i * j);
cout << ans << endl;
}