eolymp
bolt
Try our new interface for solving problems
published at 4/17/23, 6:12:16 pm

Існують тести які містять пробіли в словах,символи з кодом>256 і про них не сказано нічого в умові задачі.

published at 2/11/24, 9:49:34 am

include <bits/stdc++.h>

using namespace std; bool f1(string soz,string hisse){ int say=0; map<char,int>m1; for(char c:soz){ m1[c]++; } for(char c:hisse){ if(m1.find(c)==m1.end()|| m1[c]==0){

  return false;
}

m1[c]--; } return true;

}

int main() { iosbase::syncwith_stdio(false); cin.tie(nullptr); string soz,hisse; cin>>soz; int n; cin>>n; int a; int say=0; for(int i=0; i<n;i++){ cin>>hisse; bool t=f1(soz,hisse); if(t==true){ say++; }

}

cout<<say;

}

published at 2/11/24, 9:49:35 am

include <bits/stdc++.h>

using namespace std; bool f1(string soz,string hisse){ int say=0; map<char,int>m1; for(char c:soz){ m1[c]++; } for(char c:hisse){ if(m1.find(c)==m1.end()|| m1[c]==0){

  return false;
}

m1[c]--; } return true;

}

int main() { iosbase::syncwith_stdio(false); cin.tie(nullptr); string soz,hisse; cin>>soz; int n; cin>>n; int a; int say=0; for(int i=0; i<n;i++){ cin>>hisse; bool t=f1(soz,hisse); if(t==true){ say++; }

}

cout<<say;

}