For debug re wrote the code, then this got compiled successfully. Wired.

> Nim Compiler Version 1.2.0 [Windows: amd64]
    
    
    import algorithm, sequtils, strutils, tables
    
    proc disorganize(books: seq[string]): seq[string] =
      let step1 = books.mapIt((b :it, t: it.toCountTable))
      let step2 = step1.sortedByIt((
        it.t['A'] + it.t['a'],
        it.t['E'] + it.t['e'],
        it.t['I'] + it.t['i'],
        it.t['O'] + it.t['o'],
        it.t['U'] + it.t['u'],
        it.b.reversed.join
      ))
      let step3 = step2.mapIt(it.b)
      return = step3
    
    stdout.writeLine stdin.readAll.split("\n").disorganize.join("\n")
    
    
    Run

Reply via email to