Skip to content

Commit 0bd81e1

Browse files
authored
🎉 feat: initial commit for 1039 using java
1 parent 2d7e9d0 commit 0bd81e1

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import java.io.BufferedReader;
2+
import java.io.IOException;
3+
import java.io.InputStreamReader;
4+
5+
public class Main {
6+
public static void main(String[] args) throws IOException {
7+
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
8+
char[] c1 = br.readLine().toCharArray();
9+
char[] c2 = br.readLine().toCharArray();
10+
int[] flag = new int[256];
11+
for (int i = 0; i < c1.length; i++) {
12+
flag[c1[i]]++;
13+
}
14+
int count = c2.length;
15+
for (int i = 0; i < c2.length; i++) {
16+
if (flag[c2[i]] != 0){
17+
flag[c2[i]]--;
18+
count--;
19+
}
20+
}
21+
if (count == 0) {
22+
System.out.print("Yes " + (c1.length - c2.length));
23+
}else {
24+
System.out.print("No " + count);
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)