fork download
  1. object Main extends App {
  2. // your code goes here
  3.  
  4. val f:(String=>Int)=s=>s.permutations.toSeq.sorted indexOf s
  5.  
  6. println(f("AAB"))
  7. println(f("ABA"))
  8. println(f("BAA"))
  9. println(f("DCBA"))
  10.  
  11. }
Success #stdin #stdout 0.44s 4382720KB
stdin
Standard input is empty
stdout
0
1
2
23