Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
12557 蒋瀚辉 字母概率 C++ Accepted 8 MS 776 KB 360 2021-05-21 14:34:04

Tests(1/1):


Code:

#include <bits/stdc++.h> using namespace std; int main() { char a; string b; while(cin >>a) { cin >>b; double p=0; int len=b.size(); if(a>='A' && a<='Z') a+=32; for(int i=0;i<len;i++) if(b[i]>='A' && b[i]<='Z') b[i]+=32; for(int i=0;i<len;i++) if(a==b[i]) p++; printf("%.5lf\n",p/len); } return 0; }