mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
25 lines
441 B
C++
25 lines
441 B
C++
|
#include<stdio.h>
|
||
|
#include<string.h>
|
||
|
int main()
|
||
|
{
|
||
|
double s,n,m;
|
||
|
int i,l;
|
||
|
char h,c[200];
|
||
|
while(scanf("%c %s",&h,c)==2)
|
||
|
{
|
||
|
getchar();
|
||
|
l=strlen(c);
|
||
|
if(h<='Z')
|
||
|
h=h+32;
|
||
|
for(i=0,n=0;i<l;i++)
|
||
|
{
|
||
|
if(c[i]<='Z')
|
||
|
c[i]+=32;
|
||
|
if(c[i]==h)
|
||
|
n++;
|
||
|
}
|
||
|
s=n/l;
|
||
|
printf("%.5lf\n",s);
|
||
|
}
|
||
|
}
|