Advertisement
AngelGiurov

Untitled

Apr 25th, 2021
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. Word Anagrams
  2. You are given a word W and words WORDS. You tasks is to check whether the words from WORDS are anagrams of W.
  3.  
  4. An anagram of a word is every other word that has exactly the same number of characters as the original word but in different order. Example:
  5.  
  6. The following are anagrams of "anagram":
  7. "gramana", "aaagrnm", "margana", etc..
  8. The following are NOT anagrams of "anagram":
  9. "aanagram", "aaagram", "anagra", "anagrama", "yxy"
  10. Input
  11. Read from the standard input
  12.  
  13. On the first line, find the word W
  14. On the second line, find N - the number of words in WORDS
  15. On the next N lines, find a single word from WORDS
  16. Output
  17. Print to the standard output
  18.  
  19. For each word from WORDS print either:
  20. "Yes", if the word is an anagram of W
  21. "No", if the word is NOT an anagram of W
  22. Sample tests
  23. Input
  24. anagram
  25. 6
  26. gramana
  27. aaagrnm
  28. anagra
  29. margana
  30. abc
  31. xy
  32. Output
  33. Yes
  34. Yes
  35. No
  36. Yes
  37. No
  38. No
  39. Java
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement