提交时间:2020-01-03 20:41:09
运行 ID: 4312
#include<iostream> 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; }