提交时间:2019-12-29 10:38:57

运行 ID: 4145

#include<bits/stdc++.h> using namespace std; int main(){ char c,a[201]; while(scanf("%c%*c%s%*c",&c,a)!=EOF){ int i=0,sum=0; if(c>='a')c=c-32; while(a[i]!='\0'){ if(a[i]>='a')a[i]=a[i]-32; if(a[i]==c)sum++; i++; } printf("%.5f\n",sum*1.0/i); } return 0; }