Untitled

mail@pastecode.io avatar
unknown
plain_text
8 months ago
719 B
4
Indexable
Never
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string games, a;
    cin>>games>>a;
    string b[100];
    int l=games.length();
    for(int i=0; i<l; i++){
        b[i] = games[i];
        
    }
    
    int d;
    int c[100]={0};
    for(int i=0; i<l; i++){
        while(d!=-1){
            d = a.find(b[i]);
            if(d==-1) break;
            else{
                c[i]++;
                a.erase(d,1);
            }
            
        }
    d=0;
    }
    int n=a.size();
    int m=0;
    for(int i=0; i<n; i++){
        if(a[i]=='.') m++;
        
    }
    
    for(int i=0; i<l; i++){
        cout<<b[i]<<": "<<c[i]<<endl;
        
    }
    
    cout<<"Broken: "<<m;
    
}
Leave a Comment