1039.到底买不买

xiaoxiao2021-02-28  54

#include <iostream> using namespace std; int main() { string s1, s2; cin >> s1 >> s2; int count = 0; int flag = 0; for(int i = 0; i < s2.length(); i++) { for(int j = 0; j < s1.length(); j++) { if(s2[i] == s1[j]) { s1[j] = ' '; count++; break; } } if(count == s2.length()) { flag = 1; } } if(flag) { cout << "Yes" << " " << s1.length() - count; } else { cout << "No" << " " << s2.length() - count; } return 0; }
转载请注明原文地址: https://www.6miu.com/read-2628066.html

最新回复(0)