Skip to content

Commit 64fcd13

Browse files
Handling upper case character as lower case on wordOcurrences function
1 parent b6aaf1d commit 64fcd13

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/scala/forcomp/Anagrams.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ object Anagrams {
3434
* same character, and are represented as a lowercase character in the occurrence list.
3535
*/
3636
def wordOccurrences(w: Word): Occurrences =
37-
w.groupBy(x => x).toList map ({case (c,l) => (c,l.length)}) sorted
37+
w.toLowerCase.groupBy(x => x).toList map ({case (c,l) => (c,l.length)}) sorted
3838

3939
/** Converts a sentence into its character occurrence list. */
4040
def sentenceOccurrences(s: Sentence): Occurrences = ???

0 commit comments

Comments
 (0)