Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please i need code in rudy code style for both the count_words and anagram_groups and the instructions for each are below this for the count_words
please i need code in rudy code style for both the count_words and anagram_groups and the instructions for each are below this for the count_words and for the anagram_groups thank you end def count_words # your code here end def anagram groups your code here end end # make all the above functions available as insta class String include FunWithStrings end Remove the disabled => true from the 'word count' collection in the spec/fun_with_strings_spec.rb file. Don't forget to save your changes! Define a function 'count_words' that, given an input string, will return a hash whose keys are words in the string and whose values are the number of times each word appears: "To be or not to be" # => {"to"=>2, "be"=>2, "or"=>1, "not"=>1} Notes: Your solution shouldn't use for-loops, but iterators like 'each' are permitted. As before, nonwords and case should be ignored. A word is defined as a string of characters between word boundaries, Remove the, :disabled => true from the 'anagram grouping' collection in the spec/fun_with_strings_spec.rb file. Don't forget to save your changes! An anagram group is a group of words such that any one can be converted into any other just by rearranging the letters. For example, "rats", "tars" and "star" are an anagram group. Given a space separated list of words in a single string. write a method called 'anagram_groups' that groups these words into anagram groups and returns a nested array of those groups (an array of arrays). Hint: Look at the spec file to see what kind of return value is expected! Notes: Case doesn't matter in classifying string as anagrams (but case should be preserved in the output) The order of the anagrams in the groups doesn't matter
please i need code in rudy code style for both the count_words and anagram_groups
and the instructions for each are below
this for the count_words and
for the anagram_groups thank you
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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