Question 1: AnagramsSolver [100 marks] Anagrams are words made by rearranging the letters of other words....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Question 1: AnagramsSolver [100 marks] Anagrams are words made by rearranging the letters of other words. For example, "cheater" is an anagram of "teacher", or "dictionary" is an anagram of "indicatory". Anagrams have been around since the ancient Greeks and are used in different ways from showing mystical meaning in names to anagrammatic poetry. An interesting example of using anagrams is how scientists announce new discoveries in the 17th century. In 1610, the Italian astronomer Galileo Galilei used the anagram "smaismrmilmepoetaleumi- bunenugttauiras" for "Altissimum planetam tergeminum observavi" ("I have observed the most distant planet to have a triple form") for discovering the rings of Saturn. You are asked to write a program called AnagramSolver to find the number of all lists of words that are anagrams of each other in a given list of strings. To define more exactly, two words are considered anagrams if 1) There is the same number of characters in both words, and 2) You can form one word by rearranging the characters of another word. AnagramSolver works as follows: It takes a positive integer n as the first input. Integer n determines the number of words that AnagramSolver is supposed to receive from the user. AnagramSolver assumes the user provides a number greater than zero. . Subsequently, AnagramSolver receives the words in n separate lines. AnagramSolver is case-insensitive, meaning that it does not discriminate between uppercase and lowercase letters. AnagramSolver should ignore space and comma characters in the user-provided words. For example, Eleven plus two should be considered as Elevenplustwo. AnagramSolver should find all sets of words that are anagrams of each other and print out the size of the largest set in a separate line. Three examples are shown in table 1. In example 1, first, the user entered 6 for the number of words. This means AnagramSolver should take 6 words in separate lines from the user. Next, the user entered the words eat, tea, tan, ate, nat and bat. Now, AnagramSolver processes the given words to find the set of words that are anagrams of each other. There are two such sets: {eat, tea, ate} and {tan, nat}. The largest set size is 3 and AnagramSolver prints out 3. The same logic is applied to other examples. You are free to use the modules introduced during the semester (and nothing beyond) to solve the problem. Note that your program input and output format should be exactly the same as the format of the examples shown in Table 1. Example 1 6 eat tea tan ate nat bat 3 Table 1: The AnagramSolver Sample Input and Output Example 2 Example 3 2 Eleven plus two Twelve plus one 2 6 dormitory dirty room Angel arc glean car 2 Question 1: AnagramsSolver [100 marks] Anagrams are words made by rearranging the letters of other words. For example, "cheater" is an anagram of "teacher", or "dictionary" is an anagram of "indicatory". Anagrams have been around since the ancient Greeks and are used in different ways from showing mystical meaning in names to anagrammatic poetry. An interesting example of using anagrams is how scientists announce new discoveries in the 17th century. In 1610, the Italian astronomer Galileo Galilei used the anagram "smaismrmilmepoetaleumi- bunenugttauiras" for "Altissimum planetam tergeminum observavi" ("I have observed the most distant planet to have a triple form") for discovering the rings of Saturn. You are asked to write a program called AnagramSolver to find the number of all lists of words that are anagrams of each other in a given list of strings. To define more exactly, two words are considered anagrams if 1) There is the same number of characters in both words, and 2) You can form one word by rearranging the characters of another word. AnagramSolver works as follows: It takes a positive integer n as the first input. Integer n determines the number of words that AnagramSolver is supposed to receive from the user. AnagramSolver assumes the user provides a number greater than zero. . Subsequently, AnagramSolver receives the words in n separate lines. AnagramSolver is case-insensitive, meaning that it does not discriminate between uppercase and lowercase letters. AnagramSolver should ignore space and comma characters in the user-provided words. For example, Eleven plus two should be considered as Elevenplustwo. AnagramSolver should find all sets of words that are anagrams of each other and print out the size of the largest set in a separate line. Three examples are shown in table 1. In example 1, first, the user entered 6 for the number of words. This means AnagramSolver should take 6 words in separate lines from the user. Next, the user entered the words eat, tea, tan, ate, nat and bat. Now, AnagramSolver processes the given words to find the set of words that are anagrams of each other. There are two such sets: {eat, tea, ate} and {tan, nat}. The largest set size is 3 and AnagramSolver prints out 3. The same logic is applied to other examples. You are free to use the modules introduced during the semester (and nothing beyond) to solve the problem. Note that your program input and output format should be exactly the same as the format of the examples shown in Table 1. Example 1 6 eat tea tan ate nat bat 3 Table 1: The AnagramSolver Sample Input and Output Example 2 Example 3 2 Eleven plus two Twelve plus one 2 6 dormitory dirty room Angel arc glean car 2
Expert Answer:
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Posted Date:
Students also viewed these programming questions
-
Your task is to create a game where the users can play with words and numbers. The game has three consecutive levels (Level 1, Level 2, and Level 3). Users can proceed to the next level after...
-
You are 40 years old and want to retire at age 55. Each year, starting one year from now, you will deposit an equal amount into a savings account that pays 7% interest. The last deposit will be on...
-
A record company needs to produce 100 gold records at one or more of its three studios. the cost of producing x records at studio 1 is 10 x; the cost of producing y records at studio 2 is 2y 2 ; the...
-
The Earth's orbit around the Sun is slightly elliptical (see Conceptual Example 12-7). At Earth's closest approach to the Sun (perihelion) the orbital radius is 1.471 1011 m, and at its farthest...
-
Beachmont Restaurants, Inc. enters into a lease for standard stoves and grills. The lease term is 3 years with no renewal or purchase options. There is no residual value guarantee. and the lease...
-
A viscous fluid is poured onto a horizontal plate as shown in Fig. P7.27. Assume that the time, \(t\), required for the fluid to flow a certain distance, \(d\), along the plate is a function of the...
-
Ho Designs experienced the following events during 2016, its first year of operation: 1. Started the business when it acquired $70,000 cash from the issue of common stock. 2. Paid $41,000 cash to...
-
What is the financial impact (financial/fiscal ramnification of artificial intelligence (AI)) on the econonly and jobs starting with federal or legislative statutes or regualtions and its influences...
-
On January 1, 2020, Bonita Corporation issued a series of 400 convertible bonds, maturing in five years. The face amount of each bond was $1,000. Bonita received $439,000 for the bond issue. The...
-
Create the P-V, V-T, P-T diagrams. A straight line on the P-V diagram represents the 4-1 process. Calculate the thermal efficiency of the thermodynamic cycle 1-2-3-4-1.
-
Oil (u= 0.38 N.s/m^2) flows between parallel plates spaced 5mm apart. The bottom plate is fixed, but the upper plate moves with a velocity of 0.24 in the positive x direction. The pressure gradient...
-
Write Newton's 2nd law of motion. Write the equation for centripetal force. Write the Month and Day of the Assignment Due Date. For example, if the assignment is due on Month-2 Day-27. For an object...
-
A steady, non-viscous incompressible fluid flows from an inclined nozzle as shown in the figure. N.B. Label clearly all the points you use. (a)Determine the expression of the water elevation h(x) in...
-
Group B1 (Binary Search Tree) Beginning with an empty binary search tree, Construct binary search tree by inserting the values in the order given. After constructing a binary tree - i. Insert new...
-
If Lisa is 17 and 360 days old and makes a contract with RentACenter, what are the ramifications of her actions? a. Can Lisa make a valid contract? Why or why not? b. What happens if she contracts,...
-
A new car sold for $31,000. If the vehicle loses 15% of its value each year, how much will it be worth after 10 years?
-
Which of the following is the correct syntax to declare an array of ten integers? a. int a[10] = new int[10]; b. int[10] a = new int[10]; c. []int a = [10]int; d. int a[10]; e. int[] a = new int[10];
-
Write a method called inOrderList that returns a list containing the sequence of values obtained from an inorder traversal of your binary tree of integers. For example, if a variable t refers to...
-
Write a method called distance that accepts four integer coordinates x 1 , y 1 , x 2 and y 2 as parameters and computes the distance between points (x 1 , y 1 ) and (x 2 , y 2 ) on the Cartesian...
-
Temperature is an intensive property. State True (T) or False (F)
-
Kinetic energy is an extensive property. State True (T) or False (F)
-
A nozzle represents an open system. State True (T) or False (F)
Study smarter with the SolutionInn App