Royale With Cheese

Vincent Vega and his friend/partner Jules Winnfield are hitting the road in search of a person to “make a visit”. Yes, they are both hitman, and there’s a particular conversation going on right now, pay attention to the details: Vincent: You know what the funniest thing about Europe is? Jules: What? Vincent: It’s the little differences. I mean they got the same things over there that they got here ... but it’s just there, it’s a little different. Jules: Example? Vincent: You can walk into a movie theater in Amsterdam and buy a beer and I don’t mean just like in an old paper cup, i’m talkin’ about a glass of beer. In Paris, you can buy a beer in McDonald’s. Vincent: You know what they call a ... a ... a Quarter Pounder with Cheese in Paris? Jules: They don’t call it a Quarter Pounder with cheese? Vincent: No man, they got the metric system. They wouldn’t know what a Quarter Pounder is. Jules: Then what do they call it? Vincent: They call it a Royale with cheese. Jules: A Royale with cheese. What do they call a Big Mac? Vincent: Well, a Big Mac’s a Big Mac, but they call it le Big-Mac. Jules: Le Big-Mac. Ha ha ha ha. What do they call a Whopper? Vincent: Well, a Whopper here it’s just a Whopper there. Some things never change ... Interesting last words of Mr. Vincent Vega, because I went to Amsterdam last summer and there is a peculiarity with the numbering system of houses. The funny thing about this system is that the police have to decode the house’s numbering system when they give information back to the police station. Let me give you an example: A house identified by the following id “abbchocx”, is identified by the police under the id = 15534239. Each character that has not appeared previously in the sequence, takes an ascending numeric value, startingin1: a=1,b=2,c=3,h=4,o=5,x=6. Whenacharacterhastakenanumericvalue, every repetition of the character will have the same value. One last thing to take on count is that the police love to exchange some digits: In the resultant id every 2 will become a 5, and every 6 will become a 9 (in the same way, every 5 becomes a 2, and every 9 becomes a 6). It’s weird, I know. It’s even weirder that from a trip I took last summer to Amsterdam, I have knowledge of all that. I guess the funny thing about Europe are in fact, “the little differences”. Input The input consists of multiple test cases. Each test case contains a string S with length n (1 ≤ n ≤ 105) identifying a house in the weird numbering system implemented in Amsterdam. The string S is formed only with 26 lowercase letters (a → z). Output For each id of a house in Amsterdam’s numbering system, you have to output a codified version of the ID just as the police usually do. Each output goes on one line. Sample Input abbchocx

2/2 maplortycbjce Sample Output 15534239 1534297861011615