-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpa_1092.cpp
50 lines (45 loc) · 950 Bytes
/
pa_1092.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// mainx.cpp
// cppprogram
//
// Created by thomas on 15/11/27.
// Copyright © 2015年 thomas. All rights reserved.
//
#include <iostream>
#include <string>
#include <list>
#include <utility>
#include <cstdio>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
map<char,int> m;
string line1,line2;
cin>>line1>>line2;
for(char i='0';i<='9';i++){
m[i]=0;
}
for(char i='a';i<='z';i++){
m[i]=0;
}
for(char i='A';i<='Z';i++){
m[i]=0;
}
for(int i=0;i<line1.length();i++){
m[line1[i]]+=1;
}
for(int i=0;i<line2.length();i++){
m[line2[i]]-=1;
}
int needed=0;
for(map<char,int>::iterator iter=m.begin();iter!=m.end();iter++){
if(iter->second<0)needed-=iter->second;
}
if(needed!=0)cout<<"No "<<needed;
else{
cout<<"Yes "<<line1.length()-line2.length();
}
return 0;
}