Guest User

Untitled

a guest
Jan 23rd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. ACM International Collegiate Programming Contest, Asia-Amritapuri Site, 2011
  2. Problem B: Count Dracula
  3. Vampires are supposed to enjoy counting so much that in old Europe they would scatter some rice in coffins when they buried people, so that if the corpses came awake at night and became vampires, they would be kept busy until morning counting the grains of rice.
  4.  
  5. But not all vampires are evil, and the one in the picture has promised to help Harry Potter fight Voldemort, the evil Dark Lord. But instead of learning the magic spells Harry has listed for him, our Count gets distracted and starts to count the letters in the spells.
  6.  
  7. Can you help the Count count the letters in the spells quickly so that he can move on to actually learning and memorizing the spells?
  8.  
  9. Count Dracula
  10. Constraints
  11. The word will have at most 1000 characters.
  12. Time limit: 1 second
  13. Input (STDIN):
  14. The input contains a single word containing only lower-case letters.
  15. Output (STDOUT):
  16. Output each character followed by its count, separated by a single space. The characters should appear in order 'a' to 'z', and only the letters having a positive frequency should be output. There should be no extra white space at the end of each line.
  17. Sample Input:
  18. helloworld
  19. Sample Output:
  20. d 1
  21. e 1
  22. h 1
  23. l 3
  24. o 2
  25. r 1
  26. w 1
Add Comment
Please, Sign In to add comment