Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
112595 汤奕硕 字母概率 Python3 Accepted 37 MS 3764 KB 358 2025-03-09 18:32:31

Tests(1/1):


Code:

import sys for line in sys.stdin: line = line.strip() if not line: continue parts = line.split() if len(parts) < 2: print("0.00000") continue char = parts[0].lower() word = parts[1].lower() count = word.count(char) probability = count / len(word) print("{0:.5f}".format(probability))