forked from Vicfred/codeforces-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
amusing_joke_141A.rs
51 lines (39 loc) · 1.09 KB
/
amusing_joke_141A.rs
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
51
// https://codeforces.com/problemset/problem/141/A
use std::io;
use std::collections::HashMap;
fn main() {
let mut guest = String::new();
let mut host = String::new();
let mut letters = String::new();
io::stdin()
.read_line(&mut guest)
.unwrap();
let guest = guest.trim().to_string();
io::stdin()
.read_line(&mut host)
.unwrap();
let host = host.trim().to_string();
io::stdin()
.read_line(&mut letters)
.unwrap();
let letters = letters.trim().to_string();
let mut original = HashMap::new();
let mut pile = HashMap::new();
for ch in guest.chars() {
let counter = original.entry(ch).or_insert(0);
*counter += 1;
}
for ch in host.chars() {
let counter = original.entry(ch).or_insert(0);
*counter += 1;
}
for ch in letters.chars() {
let counter = pile.entry(ch).or_insert(0);
*counter += 1;
}
if original == pile {
println!("YES");
} else {
println!("NO");
}
}