fork(2) download
  1. import java.util.*;
  2.  
  3. class B_Letter {
  4. public static void main(String[] args) {
  5. Map<Character, Integer> charset = new HashMap<Character, Integer>();
  6. for (char c = 'A'; c <= 'Z'; ++c) {
  7. charset.put(c, 0);
  8. }
  9. for (char c = 'a'; c <= 'z'; ++c) {
  10. charset.put(c, 0);
  11. }
  12. Scanner s = new Scanner(System.in);
  13. for (char c : s.nextLine().toCharArray()) {
  14. if (c != ' ') {
  15. charset.put(c, charset.get(c) + 1);
  16. }
  17. }
  18. for (char c : s.nextLine().toCharArray()) {
  19. if (c != ' ') {
  20. int n = charset.get(c) - 1;
  21. if(n < 0){
  22. System.out.println("NO");
  23. return;
  24. }
  25. charset.put(c, n);
  26. }
  27. }
  28. System.out.println("YES");
  29. }
  30. }
  31.  
Success #stdin #stdout 0.07s 213312KB
stdin
Instead of dogging Your footsteps it disappears but you dont notice anything
where is your dog
stdout
NO