Advertisement
Debashish_Saha

Untitled

Jan 12th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main() {
  4.     string S;
  5.     cin>>S;
  6.     int B=0,u=0,l=0,b=0,a=0,s=0,r=0,count=0,n=1;
  7.     int ln=S.size();
  8.     for(int i=0; i<ln; i++) {
  9.         if(S[i]=='B') B++;
  10.         else if(S[i]=='u') u++;
  11.         else if(S[i]=='l') l++;
  12.         else if(S[i]=='b') b++;
  13.         else if(S[i]=='s') s++;
  14.         else if(S[i]=='a') a++;
  15.         else if(S[i]=='r') r++;
  16.         if(B>=n&&b>=n*2&&u>=n*2&&a>=n*2&&l>=n&&s>=n&&r>=n) {
  17.             count++;
  18.             n++;
  19.         }
  20.     }
  21.     cout<<count<<endl;
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement