According to the design idea of temperature conversion program in the textbook , according to 1 dollar = 6 The exchange rate of RMB prepares the two-way exchange procedure between USD and RMB .
Enter a line of string , Indicates the amount of RMB or US dollars . Ensure that the last bit of the string is A-Z The letter of , All other positions are numbers .
The last place of RMB must be ‘R’ perhaps ‘r’
The last dollar must be ‘D’ perhaps ‘d’
Output the converted result . The result is expressed as a string , Output an integer in front , Last bit output “R” perhaps “D” Means RMB or US dollar .
If you can't convert , Output “Error!” .
12R
2D
str1=input()
digit=''
eng=''
for i in range(0, len(str1)):
if(str1[i].isdigit()):
digit=digit+str1[i]
else:
eng=eng+str1[i]
if((eng=='D')|(eng=='d')):
printnum=int(digit)*6
outstr1=str(printnum)+'R'
print(outstr1)
elif((eng=='R')|(eng=='r')):
printnum=int(int(digit)/6)
outstr2=str(printnum)+'D'
print(outstr2)
else:
print('Error!')