#include<iostream>
using namespace std;
int main()
{
do{
char idNumber[10];
int Num[10];
int result = 0;
cout<<"輸入身分證字號: ";
cin>>idNumber;
// 將陣列第一元素(字母)轉換成數字
if(idNumber[0] == 'A') idNumber[0] = 10;
if(idNumber[0] == 'J') idNumber[0] = 18;
if(idNumber[0] == 'S') idNumber[0] = 26;
if(idNumber[0] == 'B') idNumber[0] = 11;
if(idNumber[0] == 'K') idNumber[0] = 19;
if(idNumber[0] == 'T') idNumber[0] = 27;
if(idNumber[0] == 'C') idNumber[0] = 12;
if(idNumber[0] == 'L') idNumber[0] = 20;
if(idNumber[0] == 'U') idNumber[0] = 28;
if(idNumber[0] == 'D') idNumber[0] = 13;
if(idNumber[0] == 'M') idNumber[0] = 21;
if(idNumber[0] == 'V') idNumber[0] = 29;
if(idNumber[0] == 'E') idNumber[0] = 14;
if(idNumber[0] == 'N') idNumber[0] = 22;
if(idNumber[0] == 'W') idNumber[0] = 32;
if(idNumber[0] == 'F') idNumber[0] = 15;
if(idNumber[0] == 'O') idNumber[0] = 35;
if(idNumber[0] == 'X') idNumber[0] = 30;
if(idNumber[0] == 'G') idNumber[0] = 16;
if(idNumber[0] == 'P') idNumber[0] = 23;
if(idNumber[0] == 'Y') idNumber[0] = 31;
if(idNumber[0] == 'H') idNumber[0] = 17;
if(idNumber[0] == 'Q') idNumber[0] = 24;
if(idNumber[0] == 'Z') idNumber[0] = 33;
if(idNumber[0] == 'I') idNumber[0] = 34;
if(idNumber[0] == 'R') idNumber[0] = 25;
// 英文轉成的數字, 個位數乘9再加上十位數的數字
Num[0] = (idNumber[0]/10) + (idNumber[0]%10)*9;
// 計算陣列元素值
for(int i = 0, j = 8;i<9;i++, j--) {
Num[i+1] = (idNumber[i+1]-48)*j;
if(j == 0)
Num[i+1] = idNumber[i+1]-48;
}
// 計算]陣列元素的和
for(int i=0;i<1;i++) {
result = (Num[i] + Num[i+1] + Num[i+2] + Num[i+3] + Num[i+4] + Num[i+5] + Num[i+6] + Num[i+7] + Num [i+8] + Num[i+9]);
}
//除以10取餘數若為0,表整除則為 real,否則為 fake
cout<<(result%10 == 0 ? "real" : "fake" )<<endl;
}while(true);
return 0;
}
int main()
{
char idNumber[10];
int iNum[10];
int result = 0;
while(cin>>idNumber){
if(idNumber[0] == 'A') idNumber[0] = 10;if(idNumber[0] == 'J') idNumber[0] = 18;if(idNumber[0] == 'S') idNumber[0] = 26;
if(idNumber[0] == 'B') idNumber[0] = 11;if(idNumber[0] == 'K') idNumber[0] = 19;if(idNumber[0] == 'T') idNumber[0] = 27;
if(idNumber[0] == 'C') idNumber[0] = 12;if(idNumber[0] == 'L') idNumber[0] = 20;if(idNumber[0] == 'U') idNumber[0] = 28;
if(idNumber[0] == 'D') idNumber[0] = 13;if(idNumber[0] == 'M') idNumber[0] = 21;if(idNumber[0] == 'V') idNumber[0] = 29;
if(idNumber[0] == 'E') idNumber[0] = 14;if(idNumber[0] == 'N') idNumber[0] = 22;if(idNumber[0] == 'W') idNumber[0] = 32;
if(idNumber[0] == 'F') idNumber[0] = 15;if(idNumber[0] == 'O') idNumber[0] = 35;if(idNumber[0] == 'X') idNumber[0] = 30;
if(idNumber[0] == 'G') idNumber[0] = 16;if(idNumber[0] == 'P') idNumber[0] = 23;if(idNumber[0] == 'Y') idNumber[0] = 31;
if(idNumber[0] == 'H') idNumber[0] = 17;if(idNumber[0] == 'Q') idNumber[0] = 24;if(idNumber[0] == 'Z') idNumber[0] = 33;
if(idNumber[0] == 'I') idNumber[0] = 34;if(idNumber[0] == 'R') idNumber[0] = 25;
iNum[0] = (idNumber[0]/10) + (idNumber[0]%10)*9;
for(int i = 0, j = 8;i<9;i++, j--) {
iNum[i+1] = (idNumber[i+1]-48)*j;
if(j == 0)
iNum[i+1] = idNumber[i+1]-48;
}
for(int i=0,j=1;i<1;i++,j++)
result = (iNum[i] + iNum[i+1] + iNum[i+2] + iNum[i+3] + iNum[i+4] + iNum[i+5] + iNum[i+6] + iNum[i+7] + iNum[i+8] + iNum[i+9]);
cout<<(result%10 == 0 ? "real" : "fake" )<<endl;
}
}
// 把do{. . }while(true) 改成 while(cin>>idNumber) {} 便可AC