C++ 代码
#include <iostream>
#include <cstring>
using namespace std;
int temp;
string s, t;
int main()
{
cin >> s;
for (auto& c : s) if (isdigit(c)) t += c;
if (s.back() != 'X') t.pop_back();
for (int i = 0; i < t.size(); ++ i)
{
temp += (t[i] - '0') * (i + 1);
temp %= 11;
}
if (temp == s.back() - '0' || (s.back() == 'X' && temp == 10)) cout << "Right";
else
{
s.pop_back();
cout << s;
if (temp < 10) cout << temp;
else cout << 'X';
}
return 0;
}