Assignment 5

   You shall write a C++ program that:

  1. Reads an arbitrary number of whitespace-delimited tokens from standard input.
  2. Determines and prints (to standard output) two decimal integer values:
    1. The number of input tokens that are valid Scrabble words (case-insensitive), i.e. those that can be found in /srv/datasets/scrabble-hybrid.
    2. The total number of points that all those words would be worth in Scrabble, according to the letter values in /srv/datasets/scrabble-letter-values.

Specific Requirements

  1. You may assume that the number of valid words and the total number of points will not exceed the range of an unsigned 64-bit integer.
  2. Open and read the contents of each relevant data file exactly once.
  3. Make sure to use STL components that will avoid any gross inefficiencies (excessive computation and/or storage) in your program. Your program should at least be able to process each of the example inputs below in no more than 5 seconds, on our server.
  4. Print the two integer values in the order specified above, and make sure your output contains no other numeric decimal values. Otherwise, the format of output is up to you.
Tags: No tags