Question
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.
-
Reads an arbitrary number of whitespace-delimited tokens from standard input.
-
Determines and prints (to standard output) two decimal integer values:
-
The number of input tokens that are valid Scrabble words (case-insensitive),
-
The total number of points that all those words would be worth in Scrabble, according to the letter values in :
-
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
-
-
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).
-
Open and read the contents of each relevant data file exactly once.
-
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.
-
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.
-
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started