Run ID:150987

提交时间:2026-04-02 16:01:27

#include <iostream> #include <string> #include <cstdio> #include <cctype> using namespace std; int main() { char c; string s; // 多组读取字母+单词 while (cin >> c >> s) { char tar = tolower(c); int cnt = 0; int len = s.size(); for (char ch : s) { if (tolower(ch) == tar) cnt++; } double p = 1.0 * cnt / len; printf("%.5f\n", p); } return 0; }