Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- #include <stack>
- #include <algorithm>
- #include <iostream>
- //#include <bits/stdc++.h>
- using namespace std;
- void compare_two_strings(string A, string B) {
- vector<int> cntA(26, 0);
- vector<int> cntB(26, 0);
- for(int i = 0; i < A.size(); i++) {
- cntA[A[i] - 'A']++;
- }
- for(int i = 0; i < B.size(); i++) {
- cntB[B[i] - 'A']++;
- }
- for(int i = 0; i < 26; i++) {
- if(cntA[i] > cntB[i]) {
- cout << "NO" << endl;
- return;
- }
- }
- cout << "YES" << endl;
- }
- int main()
- {
- compare_two_strings("IN", "NIM");
- compare_two_strings("AB", "AAA");
- compare_two_strings("ABC", "AABC");
- int n;
- cin >> n;
- vector<string> v;
- for(int i = 0; i < n; i++) {
- string s;
- cin >> s;
- sort(s.begin(), s.end());
- v.push_back(s);
- }
- for(int i = 0; i < n; i++) {
- vector<int> cnt(26, 0);
- for(int j = 0; j < v[i].size(); j++) {
- cnt[v[i][j] - 'A']++;
- }
- }
- return 0;
- }
- /*
- AR A: 1 R: 1
- AKR A: 1 K: 1 R: 1
- AKRT A: 1 K: 1 R: 1 T: 1
- AIKR A: 1 I: 1 K: 1 R: 1
- AAKRT A: 2 K: 1 R: 1 T:1
- AIKLR A: 1 I: 1 K: 1 L: 1 R: 1
- AIKLRT A: 1 I: 1 K: 1 L: 1 R: 1 T: 1
- AIKLORT A: 1 I: 1 K: 1 L: 1 O: 1 R: 1 T: 1
- **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement