Identical words in a list

  • 6
  • Locked
Searching for duplicates and matches is a favorite exercise for programmers. Let's do this: use the keyboard to read a list of 20 words and count how many identical words the list contains. We'll represent the result as a Map, where the key is a unique string, and the value is the number of times this string occurs in the list.
You can't complete this task, because you're not signed in.
Comments (3)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Level 18 , Sofia, Bulgaria
20 January 2021, 12:12
Is it just me, but I love lambda expressions and I keep complicating my life, trying to solve each challenge by using them... I solved this like this: for each string in the list, put in ( string, list filter if a word is equal to the string and count it. Download the solution: the most simple solution ever....why do I keep doing this to myself :D
Nyerges Ferenc
Level 23 , Bükkábrány, Hungary
9 January 2020, 19:41
Maybe its just my understanding, but "The case (uppercase/lowercase) affects the results." is not clear in my reading - affects but how? is "apple" and "Apple" are to be counted as one word or two? Anyway, I took it as separate and my solution was accepted.
Level 23 , Warsaw, Poland
5 May 2019, 17:54
micro bug in validation - the tests do not check how many words have been inserted to words array (it validates with eg 4 as well as with 20 words in the array .)