- 结果正确-100%
- 代码规范-100%
import sys
def convert_to_seconds(time_str):
time_str = time_str.lower()
if time_str[-1] == "s":
return float(time_str.replace('s', ''))
elif time_str[-1] == "m":
return float(time_str.replace('m', ''))*60
elif time_str[-1] == "h":
return float(time_str.replace('m', ''))*3600
elif time_str[-1] == "d":
return float(time_str.replace('d', ''))*3600*24
while True:
line = sys.stdin.readline()
line = line.strip()
if line == '':
break
print(convert_to_seconds(line))