Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++: Tournament Scrabble competitions use the Official Tournament and Club Word List as an authority for valid words in a Scrabble game. Reads an arbitrary

C++:

Tournament Scrabble competitions use the Official Tournament and Club Word List as an authority for valid words in a Scrabble game.

  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),

    2. The total number of points that all those words would be worth in Scrabble, according to the letter values in :

      1. A 1 B 3 C 3 D 2 E 1 F 4 G 2 H 4 I 1 J 8 K 5 L 1 M 3 N 1 O 1 P 3 Q 10 R 1 S 1 T 1 U 1 V 4 W 4 X 8 Y 4 Z 10
    3. 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 (unsigned long on our server).

    4. Open and read the contents of each relevant data file exactly once.

    5. 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, compiled with -Ofast.

    6. 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.

    7. Sample Executable and Expected Outpu $ cs19_scrabble_total <<< 'spinnaker' 1 word worth 15 points $ cs19_scrabble_total < /srv/datasets/many-english-words.txt 275407 words worth 4088242 points $ cs19_scrabble_total < /srv/datasets/shakespeare-othello.txt 17531 words worth 105915 points $ cs19_scrabble_total < /srv/datasets/king-james.txt 650865 words worth 4305807 points

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: David M. Kroenke

5th Edition

B000CSIH5A, 978-0023668814

Students also viewed these Databases questions