Created
March 12, 2020 14:05
-
-
Save crater2150/0523cc929593ebf3aab61e3486bb2646 to your computer and use it in GitHub Desktop.
find words with same rotation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def normalize(s: String) = (s + s).sliding(s.length).max | |
val words = scala.io.Source.fromFile("enable1.txt").getLines.toVector | |
val groupOfFour = words.toList.groupBy(normalize).filter(_._2.length == 4) | |
println(groupOfFour) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment