1 solutions
-
1
#include<bits/stdc++.h> using namespace std; int main() { char c; string s; while(cin>>c>>s) { int n=s.size(); int cnt=0; if(c>='A'&&c<='Z') { c=c-'A'+'a'; } for(int i=0;i<n;i++) { if(s[i]>='A'&&s[i]<='Z') { s[i]=s[i]-'A'+'a'; } if(s[i]==c) { cnt++; } } cout<<fixed<<setprecision(5)<<(cnt*1.0/n)<<endl; } return 0; }
- 1
Information
- ID
- 98
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 1
- Tags
- (None)
- # Submissions
- 32
- Accepted
- 20
- Uploaded By