import java.io.File
import kotlin.system.measureTimeMillis

fun main() {

    val time = measureTimeMillis {
        // Read the words and keep only 5 letters words
        val textWords = File(Signature::class.java.getResource("words_alpha.txt")!!.toURI())
            .readLines()
            .filter { it.length == 5 }

        // Let's group the words by their signature and only keep the words that have 5 distinct letters
        // Also the signature is the same for anagrams since we don't keep track of the order of letters in the signature
        val wordsBySignature: Map<Signature, List<String>> = textWords
            .groupBy { it.toSignature() }
            .filterKeys { it.distinctLetters() == 5 }

        // We get the letters and the number of time those letters appears in each signature
        // We'll use that to start with the least common letters first
        val letterCount = letters.values
            .associateWith { letter -> wordsBySignature.keys.fold(0) { acc, signature -> if (letter in signature) acc + 1 else acc } }.toList()
            .sortedBy { it.second }
            .toMap()

        println("--- Letters and occurrences")
        letterCount.forEach { (letterSignature, count) -> println("${letterSignature.letter()} -> $count") }

        // Fortunately all of those methods keep the order so it's very useful
        val orderedLetters = letterCount.keys

        // We group the word signatures by the first of the letter from the ordered letters
        // This works because we will try to fill in the letters using the same order
        val wordsByLetter = wordsBySignature
            .keys
            .groupBy { word -> orderedLetters.first { letter -> letter in word } }

        println("--- Letters and words count associated to it")
        wordsByLetter.forEach { (letterSignature, words) -> println("${letterSignature.letter()} -> ${words.size}") }

        println("--- Starting the solver loop")
        var solution = listOf(WordGroup(emptyList(), Signature.empty))
        orderedLetters.forEachIndexed { index, letter ->
            val newSolution = mutableListOf<WordGroup>()

            //This is all the letters that we tried to add so far + the current one
            val expectedLetters = letterCount.keys.take(index + 1).merge()
            //We add the previous groups that have all the letters - 1 (we want solution that have 25 of the 26 letters so we can have 1 gap)
            solution
                .filter { it.signature.commonLetters(expectedLetters).distinctLetters() >= index }
                .let { newSolution.addAll(it) }

            val wordsToCheck = wordsByLetter[letter] ?: emptyList()
            println("${lettersInverted[letter]} -> Words to check ${wordsToCheck.size}")

            // Do a cartesian product of the current solutions and words for this letter
            // Ignore any word that creates has duplicate letters or that do not have enough distinct letters (1 gap max)
            wordsToCheck
                .flatMap { word ->
                    solution
                        .filter { word !in it }
                        .map { it + word }
                        .filter { it.signature.commonLetters(expectedLetters).distinctLetters() >= index }
                }
                .let { newSolution.addAll(it) }

            // Update the solution with the new result
            solution = newSolution
            println("${lettersInverted[letter]} -> Current solution ${solution.size}")
        }

        // Now that we the solutions but we probably want to output it
        // The solution removed the anagrams and only contains the signatures we need to transform that back into words
        val words = solution
            .flatMap { it.toWords(wordsBySignature) }
            .onEach { println(it.joinToString(" ")) }

        println()
        println("Total possibilities including anagrams: ${words.size}")
        println()
        println("Total possibilities excluding anagrams: ${solution.size}")

    }

    println("${time / 1000.0} seconds")
}

// The signature is a bitset representation of the word each bit represent whether a letter is present or not
@JvmInline
value class Signature(private val value: Int) {
    operator fun plus(other: Signature): Signature = Signature(value or other.value)
    operator fun contains(other: Signature): Boolean = value and other.value != 0
    fun distinctLetters(): Int = value.countOneBits()
    fun commonLetters(other: Signature) = Signature(value and other.value)
    fun letter(): Char {
        if (distinctLetters() == 1) {
            return lettersInverted[this]!!
        } else {
            throw IllegalStateException("There is more than one letter in this signature")
        }
    }

    companion object {
        val empty = Signature(0)
    }
}

fun Iterable<Signature>.merge(): Signature = fold(Signature.empty) { acc, signature -> acc + signature }

data class WordGroup(
    val words: List<Signature>,
    val signature: Signature,
) {
    operator fun contains(word: Signature): Boolean = word in signature
    operator fun plus(word: Signature): WordGroup = WordGroup(words + word, signature + word)

    fun toWords(wordsBySignature: Map<Signature, List<String>>): List<List<String>> {
        return words
            .map { wordSignature -> wordsBySignature[wordSignature]!! }
            .fold(emptyList()) { acc, words ->
                if (acc.isEmpty()) {
                    words.map { listOf(it) }
                } else {
                    words.flatMap { word -> acc.map { it + word } }
                }
            }
    }
}

// Each letter has its own signature
val letters = mapOf(
    'a' to Signature(0b00000000000000000000000001),
    'b' to Signature(0b00000000000000000000000010),
    'c' to Signature(0b00000000000000000000000100),
    'd' to Signature(0b00000000000000000000001000),
    'e' to Signature(0b00000000000000000000010000),
    'f' to Signature(0b00000000000000000000100000),
    'g' to Signature(0b00000000000000000001000000),
    'h' to Signature(0b00000000000000000010000000),
    'i' to Signature(0b00000000000000000100000000),
    'j' to Signature(0b00000000000000001000000000),
    'k' to Signature(0b00000000000000010000000000),
    'l' to Signature(0b00000000000000100000000000),
    'm' to Signature(0b00000000000001000000000000),
    'n' to Signature(0b00000000000010000000000000),
    'o' to Signature(0b00000000000100000000000000),
    'p' to Signature(0b00000000001000000000000000),
    'q' to Signature(0b00000000010000000000000000),
    'r' to Signature(0b00000000100000000000000000),
    's' to Signature(0b00000001000000000000000000),
    't' to Signature(0b00000010000000000000000000),
    'u' to Signature(0b00000100000000000000000000),
    'v' to Signature(0b00001000000000000000000000),
    'w' to Signature(0b00010000000000000000000000),
    'x' to Signature(0b00100000000000000000000000),
    'y' to Signature(0b01000000000000000000000000),
    'z' to Signature(0b10000000000000000000000000),
)

val lettersInverted = mapOf(
    Signature(0b00000000000000000000000001) to 'a',
    Signature(0b00000000000000000000000010) to 'b',
    Signature(0b00000000000000000000000100) to 'c',
    Signature(0b00000000000000000000001000) to 'd',
    Signature(0b00000000000000000000010000) to 'e',
    Signature(0b00000000000000000000100000) to 'f',
    Signature(0b00000000000000000001000000) to 'g',
    Signature(0b00000000000000000010000000) to 'h',
    Signature(0b00000000000000000100000000) to 'i',
    Signature(0b00000000000000001000000000) to 'j',
    Signature(0b00000000000000010000000000) to 'k',
    Signature(0b00000000000000100000000000) to 'l',
    Signature(0b00000000000001000000000000) to 'm',
    Signature(0b00000000000010000000000000) to 'n',
    Signature(0b00000000000100000000000000) to 'o',
    Signature(0b00000000001000000000000000) to 'p',
    Signature(0b00000000010000000000000000) to 'q',
    Signature(0b00000000100000000000000000) to 'r',
    Signature(0b00000001000000000000000000) to 's',
    Signature(0b00000010000000000000000000) to 't',
    Signature(0b00000100000000000000000000) to 'u',
    Signature(0b00001000000000000000000000) to 'v',
    Signature(0b00010000000000000000000000) to 'w',
    Signature(0b00100000000000000000000000) to 'x',
    Signature(0b01000000000000000000000000) to 'y',
    Signature(0b10000000000000000000000000) to 'z',
)

fun String.toSignature(): Signature = map { letters[it]!! }.merge()

Compiled from "Comparisons.kt"
public final class MainKt$main$lambda$20$$inlined$sortedBy$1<T> implements java.util.Comparator {
  public MainKt$main$lambda$20$$inlined$sortedBy$1();
    Code:
       0: aload_0
       1: invokespecial #16                 // Method java/lang/Object."<init>":()V
       4: return

  public final int compare(T, T);
    Code:
       0: aload_1
       1: checkcast     #23                 // class kotlin/Pair
       4: astore_3
       5: iconst_0
       6: istore        4
       8: aload_3
       9: invokevirtual #27                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      12: checkcast     #29                 // class java/lang/Integer
      15: checkcast     #31                 // class java/lang/Comparable
      18: aload_2
      19: checkcast     #23                 // class kotlin/Pair
      22: astore_3
      23: astore        5
      25: iconst_0
      26: istore        4
      28: aload_3
      29: invokevirtual #27                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      32: checkcast     #29                 // class java/lang/Integer
      35: aload         5
      37: swap
      38: checkcast     #31                 // class java/lang/Comparable
      41: invokestatic  #37                 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I
      44: ireturn
}

Compiled from "Main.kt"
public final class MainKt {
  private static final java.util.Map<java.lang.Character, Signature> letters;

  private static final java.util.Map<Signature, java.lang.Character> lettersInverted;

  public static final void main();
    Code:
       0: iconst_0
       1: istore_2
       2: invokestatic  #12                 // Method java/lang/System.currentTimeMillis:()J
       5: lstore_3
       6: iconst_0
       7: istore        5
       9: new           #14                 // class java/io/File
      12: dup
      13: ldc           #16                 // class Signature
      15: ldc           #18                 // String words_alpha.txt
      17: invokevirtual #24                 // Method java/lang/Class.getResource:(Ljava/lang/String;)Ljava/net/URL;
      20: dup
      21: invokestatic  #30                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      24: invokevirtual #36                 // Method java/net/URL.toURI:()Ljava/net/URI;
      27: invokespecial #40                 // Method java/io/File."<init>":(Ljava/net/URI;)V
      30: aconst_null
      31: iconst_1
      32: aconst_null
      33: invokestatic  #46                 // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
      36: checkcast     #48                 // class java/lang/Iterable
      39: astore        6
      41: nop
      42: iconst_0
      43: istore        7
      45: aload         6
      47: astore        8
      49: new           #50                 // class java/util/ArrayList
      52: dup
      53: invokespecial #52                 // Method java/util/ArrayList."<init>":()V
      56: checkcast     #54                 // class java/util/Collection
      59: astore        9
      61: iconst_0
      62: istore        10
      64: aload         8
      66: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      71: astore        11
      73: aload         11
      75: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      80: ifeq          132
      83: aload         11
      85: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      90: astore        12
      92: aload         12
      94: checkcast     #70                 // class java/lang/String
      97: astore        13
      99: iconst_0
     100: istore        14
     102: aload         13
     104: invokevirtual #74                 // Method java/lang/String.length:()I
     107: iconst_5
     108: if_icmpne     115
     111: iconst_1
     112: goto          116
     115: iconst_0
     116: ifeq          73
     119: aload         9
     121: aload         12
     123: invokeinterface #78,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     128: pop
     129: goto          73
     132: aload         9
     134: checkcast     #80                 // class java/util/List
     137: nop
     138: astore        15
     140: aload         15
     142: checkcast     #48                 // class java/lang/Iterable
     145: astore        7
     147: nop
     148: iconst_0
     149: istore        8
     151: aload         7
     153: astore        9
     155: new           #82                 // class java/util/LinkedHashMap
     158: dup
     159: invokespecial #83                 // Method java/util/LinkedHashMap."<init>":()V
     162: checkcast     #85                 // class java/util/Map
     165: astore        10
     167: iconst_0
     168: istore        11
     170: aload         9
     172: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     177: astore        12
     179: aload         12
     181: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     186: ifeq          294
     189: aload         12
     191: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     196: astore        13
     198: aload         13
     200: checkcast     #70                 // class java/lang/String
     203: astore        14
     205: iconst_0
     206: istore        16
     208: aload         14
     210: invokestatic  #89                 // Method toSignature:(Ljava/lang/String;)I
     213: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     216: astore        17
     218: aload         10
     220: astore        18
     222: iconst_0
     223: istore        19
     225: aload         18
     227: aload         17
     229: invokeinterface #97,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     234: astore        20
     236: aload         20
     238: ifnonnull     273
     241: iconst_0
     242: istore        21
     244: new           #50                 // class java/util/ArrayList
     247: dup
     248: invokespecial #52                 // Method java/util/ArrayList."<init>":()V
     251: checkcast     #80                 // class java/util/List
     254: astore        21
     256: aload         18
     258: aload         17
     260: aload         21
     262: invokeinterface #101,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     267: pop
     268: aload         21
     270: goto          275
     273: aload         20
     275: nop
     276: checkcast     #80                 // class java/util/List
     279: astore        14
     281: aload         14
     283: aload         13
     285: invokeinterface #102,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     290: pop
     291: goto          179
     294: aload         10
     296: nop
     297: astore        7
     299: nop
     300: iconst_0
     301: istore        8
     303: new           #82                 // class java/util/LinkedHashMap
     306: dup
     307: invokespecial #83                 // Method java/util/LinkedHashMap."<init>":()V
     310: astore        9
     312: aload         7
     314: invokeinterface #106,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     319: invokeinterface #109,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     324: astore        10
     326: aload         10
     328: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     333: ifeq          406
     336: aload         10
     338: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     343: checkcast     #111                // class java/util/Map$Entry
     346: astore        11
     348: aload         11
     350: invokeinterface #114,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     355: checkcast     #16                 // class Signature
     358: invokevirtual #117                // Method Signature."unbox-impl":()I
     361: istore        12
     363: iconst_0
     364: istore        13
     366: iload         12
     368: invokestatic  #121                // Method Signature."distinctLetters-impl":(I)I
     371: iconst_5
     372: if_icmpne     379
     375: iconst_1
     376: goto          380
     379: iconst_0
     380: ifeq          326
     383: aload         9
     385: aload         11
     387: invokeinterface #114,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     392: aload         11
     394: invokeinterface #124,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     399: invokevirtual #125                // Method java/util/LinkedHashMap.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     402: pop
     403: goto          326
     406: aload         9
     408: checkcast     #85                 // class java/util/Map
     411: astore        6
     413: getstatic     #129                // Field letters:Ljava/util/Map;
     416: invokeinterface #133,  1          // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;
     421: checkcast     #48                 // class java/lang/Iterable
     424: astore        8
     426: nop
     427: iconst_0
     428: istore        9
     430: new           #82                 // class java/util/LinkedHashMap
     433: dup
     434: aload         8
     436: bipush        10
     438: invokestatic  #139                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     441: invokestatic  #144                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
     444: bipush        16
     446: invokestatic  #150                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     449: invokespecial #153                // Method java/util/LinkedHashMap."<init>":(I)V
     452: astore        10
     454: aload         8
     456: astore        11
     458: iconst_0
     459: istore        12
     461: aload         11
     463: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     468: astore        13
     470: aload         13
     472: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     477: ifeq          627
     480: aload         13
     482: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     487: astore        14
     489: aload         10
     491: checkcast     #85                 // class java/util/Map
     494: aload         14
     496: aload         14
     498: checkcast     #16                 // class Signature
     501: invokevirtual #117                // Method Signature."unbox-impl":()I
     504: istore        16
     506: astore        22
     508: astore        23
     510: iconst_0
     511: istore        17
     513: aload         6
     515: invokeinterface #156,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
     520: checkcast     #48                 // class java/lang/Iterable
     523: astore        18
     525: iconst_0
     526: istore        19
     528: iconst_0
     529: istore        20
     531: iload         19
     533: istore        21
     535: aload         18
     537: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     542: astore        24
     544: aload         24
     546: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     551: ifeq          604
     554: aload         24
     556: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     561: astore        25
     563: iload         21
     565: aload         25
     567: checkcast     #16                 // class Signature
     570: invokevirtual #117                // Method Signature."unbox-impl":()I
     573: istore        26
     575: istore        27
     577: iconst_0
     578: istore        28
     580: iload         26
     582: iload         16
     584: invokestatic  #160                // Method Signature."contains-yueV81A":(II)Z
     587: ifeq          597
     590: iload         27
     592: iconst_1
     593: iadd
     594: goto          599
     597: iload         27
     599: istore        21
     601: goto          544
     604: iload         21
     606: nop
     607: invokestatic  #166                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     610: astore        29
     612: aload         23
     614: aload         22
     616: aload         29
     618: invokeinterface #101,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     623: pop
     624: goto          470
     627: aload         10
     629: checkcast     #85                 // class java/util/Map
     632: nop
     633: invokestatic  #170                // Method kotlin/collections/MapsKt.toList:(Ljava/util/Map;)Ljava/util/List;
     636: checkcast     #48                 // class java/lang/Iterable
     639: astore        8
     641: nop
     642: iconst_0
     643: istore        9
     645: aload         8
     647: new           #172                // class MainKt$main$lambda$20$$inlined$sortedBy$1
     650: dup
     651: invokespecial #173                // Method MainKt$main$lambda$20$$inlined$sortedBy$1."<init>":()V
     654: checkcast     #175                // class java/util/Comparator
     657: invokestatic  #179                // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
     660: checkcast     #48                 // class java/lang/Iterable
     663: invokestatic  #183                // Method kotlin/collections/MapsKt.toMap:(Ljava/lang/Iterable;)Ljava/util/Map;
     666: astore        7
     668: ldc           #185                // String --- Letters and occurrences
     670: getstatic     #189                // Field java/lang/System.out:Ljava/io/PrintStream;
     673: swap
     674: invokevirtual #194                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     677: aload         7
     679: astore        8
     681: iconst_0
     682: istore        9
     684: aload         8
     686: invokeinterface #106,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     691: invokeinterface #109,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     696: astore        10
     698: aload         10
     700: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     705: ifeq          797
     708: aload         10
     710: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     715: checkcast     #111                // class java/util/Map$Entry
     718: astore        11
     720: aload         11
     722: astore        12
     724: iconst_0
     725: istore        13
     727: aload         12
     729: invokeinterface #114,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     734: checkcast     #16                 // class Signature
     737: invokevirtual #117                // Method Signature."unbox-impl":()I
     740: istore        14
     742: aload         12
     744: invokeinterface #124,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     749: checkcast     #196                // class java/lang/Number
     752: invokevirtual #199                // Method java/lang/Number.intValue:()I
     755: istore        16
     757: new           #201                // class java/lang/StringBuilder
     760: dup
     761: invokespecial #202                // Method java/lang/StringBuilder."<init>":()V
     764: iload         14
     766: invokestatic  #206                // Method Signature."letter-impl":(I)C
     769: invokevirtual #210                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     772: ldc           #212                // String  ->
     774: invokevirtual #215                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     777: iload         16
     779: invokevirtual #218                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     782: invokevirtual #222                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     785: getstatic     #189                // Field java/lang/System.out:Ljava/io/PrintStream;
     788: swap
     789: invokevirtual #194                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     792: nop
     793: nop
     794: goto          698
     797: nop
     798: aload         7
     800: invokeinterface #156,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
     805: astore        8
     807: aload         6
     809: invokeinterface #156,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
     814: checkcast     #48                 // class java/lang/Iterable
     817: astore        10
     819: nop
     820: iconst_0
     821: istore        11
     823: aload         10
     825: astore        12
     827: new           #82                 // class java/util/LinkedHashMap
     830: dup
     831: invokespecial #83                 // Method java/util/LinkedHashMap."<init>":()V
     834: checkcast     #85                 // class java/util/Map
     837: astore        13
     839: iconst_0
     840: istore        14
     842: aload         12
     844: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     849: astore        16
     851: aload         16
     853: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     858: ifeq          1047
     861: aload         16
     863: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     868: astore        17
     870: aload         17
     872: checkcast     #16                 // class Signature
     875: invokevirtual #117                // Method Signature."unbox-impl":()I
     878: istore        18
     880: iconst_0
     881: istore        19
     883: aload         8
     885: checkcast     #48                 // class java/lang/Iterable
     888: astore        20
     890: iconst_0
     891: istore        21
     893: aload         20
     895: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     900: astore        24
     902: aload         24
     904: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     909: ifeq          949
     912: aload         24
     914: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     919: astore        25
     921: aload         25
     923: checkcast     #16                 // class Signature
     926: invokevirtual #117                // Method Signature."unbox-impl":()I
     929: istore        26
     931: iconst_0
     932: istore        27
     934: iload         18
     936: iload         26
     938: invokestatic  #160                // Method Signature."contains-yueV81A":(II)Z
     941: ifeq          902
     944: aload         25
     946: goto          959
     949: new           #224                // class java/util/NoSuchElementException
     952: dup
     953: ldc           #226                // String Collection contains no element matching the predicate.
     955: invokespecial #229                // Method java/util/NoSuchElementException."<init>":(Ljava/lang/String;)V
     958: athrow
     959: checkcast     #16                 // class Signature
     962: invokevirtual #117                // Method Signature."unbox-impl":()I
     965: nop
     966: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     969: astore        28
     971: aload         13
     973: astore        30
     975: iconst_0
     976: istore        31
     978: aload         30
     980: aload         28
     982: invokeinterface #97,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     987: astore        32
     989: aload         32
     991: ifnonnull     1026
     994: iconst_0
     995: istore        33
     997: new           #50                 // class java/util/ArrayList
    1000: dup
    1001: invokespecial #52                 // Method java/util/ArrayList."<init>":()V
    1004: checkcast     #80                 // class java/util/List
    1007: astore        33
    1009: aload         30
    1011: aload         28
    1013: aload         33
    1015: invokeinterface #101,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    1020: pop
    1021: aload         33
    1023: goto          1028
    1026: aload         32
    1028: nop
    1029: checkcast     #80                 // class java/util/List
    1032: astore        34
    1034: aload         34
    1036: aload         17
    1038: invokeinterface #102,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
    1043: pop
    1044: goto          851
    1047: aload         13
    1049: nop
    1050: astore        9
    1052: ldc           #231                // String --- Letters and words count associated to it
    1054: getstatic     #189                // Field java/lang/System.out:Ljava/io/PrintStream;
    1057: swap
    1058: invokevirtual #194                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    1061: aload         9
    1063: astore        10
    1065: iconst_0
    1066: istore        11
    1068: aload         10
    1070: invokeinterface #106,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
    1075: invokeinterface #109,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
    1080: astore        12
    1082: aload         12
    1084: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1089: ifeq          1183
    1092: aload         12
    1094: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1099: checkcast     #111                // class java/util/Map$Entry
    1102: astore        13
    1104: aload         13
    1106: astore        14
    1108: iconst_0
    1109: istore        16
    1111: aload         14
    1113: invokeinterface #114,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
    1118: checkcast     #16                 // class Signature
    1121: invokevirtual #117                // Method Signature."unbox-impl":()I
    1124: istore        17
    1126: aload         14
    1128: invokeinterface #124,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
    1133: checkcast     #80                 // class java/util/List
    1136: astore        18
    1138: new           #201                // class java/lang/StringBuilder
    1141: dup
    1142: invokespecial #202                // Method java/lang/StringBuilder."<init>":()V
    1145: iload         17
    1147: invokestatic  #206                // Method Signature."letter-impl":(I)C
    1150: invokevirtual #210                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
    1153: ldc           #212                // String  ->
    1155: invokevirtual #215                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
    1158: aload         18
    1160: invokeinterface #234,  1          // InterfaceMethod java/util/List.size:()I
    1165: invokevirtual #218                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
    1168: invokevirtual #222                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
    1171: getstatic     #189                // Field java/lang/System.out:Ljava/io/PrintStream;
    1174: swap
    1175: invokevirtual #194                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    1178: nop
    1179: nop
    1180: goto          1082
    1183: nop
    1184: ldc           #236                // String --- Starting the solver loop
    1186: getstatic     #189                // Field java/lang/System.out:Ljava/io/PrintStream;
    1189: swap
    1190: invokevirtual #194                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    1193: aconst_null
    1194: astore        10
    1196: new           #238                // class WordGroup
    1199: dup
    1200: invokestatic  #242                // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
    1203: getstatic     #246                // Field Signature.Companion:LSignature$Companion;
    1206: invokevirtual #251                // Method Signature$Companion."getEmpty-MrUGAVo":()I
    1209: aconst_null
    1210: invokespecial #254                // Method WordGroup."<init>":(Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
    1213: invokestatic  #258                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
    1216: astore        10
    1218: aload         8
    1220: checkcast     #48                 // class java/lang/Iterable
    1223: astore        11
    1225: iconst_0
    1226: istore        12
    1228: iconst_0
    1229: istore        13
    1231: aload         11
    1233: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1238: astore        14
    1240: aload         14
    1242: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1247: ifeq          2021
    1250: aload         14
    1252: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1257: astore        16
    1259: iload         13
    1261: iinc          13, 1
    1264: istore        17
    1266: iload         17
    1268: ifge          1274
    1271: invokestatic  #261                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
    1274: iload         17
    1276: aload         16
    1278: checkcast     #16                 // class Signature
    1281: invokevirtual #117                // Method Signature."unbox-impl":()I
    1284: istore        18
    1286: istore        19
    1288: iconst_0
    1289: istore        20
    1291: new           #50                 // class java/util/ArrayList
    1294: dup
    1295: invokespecial #52                 // Method java/util/ArrayList."<init>":()V
    1298: checkcast     #80                 // class java/util/List
    1301: astore        21
    1303: aload         7
    1305: invokeinterface #156,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
    1310: checkcast     #48                 // class java/lang/Iterable
    1313: iload         19
    1315: iconst_1
    1316: iadd
    1317: invokestatic  #265                // Method kotlin/collections/CollectionsKt.take:(Ljava/lang/Iterable;I)Ljava/util/List;
    1320: checkcast     #48                 // class java/lang/Iterable
    1323: invokestatic  #269                // Method merge:(Ljava/lang/Iterable;)I
    1326: istore        24
    1328: aload         10
    1330: checkcast     #48                 // class java/lang/Iterable
    1333: astore        25
    1335: nop
    1336: iconst_0
    1337: istore        26
    1339: aload         25
    1341: astore        27
    1343: new           #50                 // class java/util/ArrayList
    1346: dup
    1347: invokespecial #52                 // Method java/util/ArrayList."<init>":()V
    1350: checkcast     #54                 // class java/util/Collection
    1353: astore        28
    1355: iconst_0
    1356: istore        30
    1358: aload         27
    1360: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1365: astore        31
    1367: aload         31
    1369: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1374: ifeq          1435
    1377: aload         31
    1379: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1384: astore        32
    1386: aload         32
    1388: checkcast     #238                // class WordGroup
    1391: astore        33
    1393: iconst_0
    1394: istore        34
    1396: aload         33
    1398: invokevirtual #272                // Method WordGroup."getSignature-MrUGAVo":()I
    1401: iload         24
    1403: invokestatic  #275                // Method Signature."commonLetters-VbpjEXU":(II)I
    1406: invokestatic  #121                // Method Signature."distinctLetters-impl":(I)I
    1409: iload         19
    1411: if_icmplt     1418
    1414: iconst_1
    1415: goto          1419
    1418: iconst_0
    1419: ifeq          1367
    1422: aload         28
    1424: aload         32
    1426: invokeinterface #78,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
    1431: pop
    1432: goto          1367
    1435: aload         28
    1437: checkcast     #80                 // class java/util/List
    1440: nop
    1441: astore        26
    1443: iconst_0
    1444: istore        27
    1446: aload         21
    1448: aload         26
    1450: checkcast     #54                 // class java/util/Collection
    1453: invokeinterface #279,  2          // InterfaceMethod java/util/List.addAll:(Ljava/util/Collection;)Z
    1458: pop
    1459: aload         9
    1461: iload         18
    1463: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
    1466: invokeinterface #97,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    1471: checkcast     #80                 // class java/util/List
    1474: dup
    1475: ifnonnull     1482
    1478: pop
    1479: invokestatic  #242                // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
    1482: astore        25
    1484: new           #201                // class java/lang/StringBuilder
    1487: dup
    1488: invokespecial #202                // Method java/lang/StringBuilder."<init>":()V
    1491: getstatic     #282                // Field lettersInverted:Ljava/util/Map;
    1494: iload         18
    1496: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
    1499: invokeinterface #97,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    1504: invokevirtual #285                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    1507: ldc_w         #287                // String  -> Words to check
    1510: invokevirtual #215                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
    1513: aload         25
    1515: invokeinterface #234,  1          // InterfaceMethod java/util/List.size:()I
    1520: invokevirtual #218                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
    1523: invokevirtual #222                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
    1526: getstatic     #189                // Field java/lang/System.out:Ljava/io/PrintStream;
    1529: swap
    1530: invokevirtual #194                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    1533: aload         25
    1535: checkcast     #48                 // class java/lang/Iterable
    1538: astore        26
    1540: nop
    1541: iconst_0
    1542: istore        27
    1544: aload         26
    1546: astore        28
    1548: new           #50                 // class java/util/ArrayList
    1551: dup
    1552: invokespecial #52                 // Method java/util/ArrayList."<init>":()V
    1555: checkcast     #54                 // class java/util/Collection
    1558: astore        30
    1560: iconst_0
    1561: istore        31
    1563: aload         28
    1565: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1570: astore        32
    1572: aload         32
    1574: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1579: ifeq          1939
    1582: aload         32
    1584: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1589: astore        33
    1591: aload         33
    1593: checkcast     #16                 // class Signature
    1596: invokevirtual #117                // Method Signature."unbox-impl":()I
    1599: istore        34
    1601: iconst_0
    1602: istore        35
    1604: aload         10
    1606: checkcast     #48                 // class java/lang/Iterable
    1609: astore        36
    1611: nop
    1612: iconst_0
    1613: istore        37
    1615: aload         36
    1617: astore        38
    1619: new           #50                 // class java/util/ArrayList
    1622: dup
    1623: invokespecial #52                 // Method java/util/ArrayList."<init>":()V
    1626: checkcast     #54                 // class java/util/Collection
    1629: astore        39
    1631: iconst_0
    1632: istore        40
    1634: aload         38
    1636: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1641: astore        41
    1643: aload         41
    1645: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1650: ifeq          1703
    1653: aload         41
    1655: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1660: astore        42
    1662: aload         42
    1664: checkcast     #238                // class WordGroup
    1667: astore        43
    1669: iconst_0
    1670: istore        44
    1672: aload         43
    1674: iload         34
    1676: invokevirtual #290                // Method WordGroup."contains-yueV81A":(I)Z
    1679: ifne          1686
    1682: iconst_1
    1683: goto          1687
    1686: iconst_0
    1687: ifeq          1643
    1690: aload         39
    1692: aload         42
    1694: invokeinterface #78,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
    1699: pop
    1700: goto          1643
    1703: aload         39
    1705: checkcast     #80                 // class java/util/List
    1708: nop
    1709: checkcast     #48                 // class java/lang/Iterable
    1712: astore        36
    1714: nop
    1715: iconst_0
    1716: istore        37
    1718: aload         36
    1720: astore        38
    1722: new           #50                 // class java/util/ArrayList
    1725: dup
    1726: aload         36
    1728: bipush        10
    1730: invokestatic  #139                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
    1733: invokespecial #291                // Method java/util/ArrayList."<init>":(I)V
    1736: checkcast     #54                 // class java/util/Collection
    1739: astore        39
    1741: iconst_0
    1742: istore        40
    1744: aload         38
    1746: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1751: astore        41
    1753: aload         41
    1755: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1760: ifeq          1805
    1763: aload         41
    1765: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1770: astore        42
    1772: aload         39
    1774: aload         42
    1776: checkcast     #238                // class WordGroup
    1779: astore        43
    1781: astore        45
    1783: iconst_0
    1784: istore        44
    1786: aload         43
    1788: iload         34
    1790: invokevirtual #295                // Method WordGroup."plus-yueV81A":(I)LWordGroup;
    1793: aload         45
    1795: swap
    1796: invokeinterface #78,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
    1801: pop
    1802: goto          1753
    1805: aload         39
    1807: checkcast     #80                 // class java/util/List
    1810: nop
    1811: checkcast     #48                 // class java/lang/Iterable
    1814: astore        36
    1816: nop
    1817: iconst_0
    1818: istore        37
    1820: aload         36
    1822: astore        38
    1824: new           #50                 // class java/util/ArrayList
    1827: dup
    1828: invokespecial #52                 // Method java/util/ArrayList."<init>":()V
    1831: checkcast     #54                 // class java/util/Collection
    1834: astore        39
    1836: iconst_0
    1837: istore        40
    1839: aload         38
    1841: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1846: astore        41
    1848: aload         41
    1850: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1855: ifeq          1916
    1858: aload         41
    1860: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1865: astore        42
    1867: aload         42
    1869: checkcast     #238                // class WordGroup
    1872: astore        43
    1874: iconst_0
    1875: istore        44
    1877: aload         43
    1879: invokevirtual #272                // Method WordGroup."getSignature-MrUGAVo":()I
    1882: iload         24
    1884: invokestatic  #275                // Method Signature."commonLetters-VbpjEXU":(II)I
    1887: invokestatic  #121                // Method Signature."distinctLetters-impl":(I)I
    1890: iload         19
    1892: if_icmplt     1899
    1895: iconst_1
    1896: goto          1900
    1899: iconst_0
    1900: ifeq          1848
    1903: aload         39
    1905: aload         42
    1907: invokeinterface #78,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
    1912: pop
    1913: goto          1848
    1916: aload         39
    1918: checkcast     #80                 // class java/util/List
    1921: nop
    1922: checkcast     #48                 // class java/lang/Iterable
    1925: nop
    1926: astore        46
    1928: aload         30
    1930: aload         46
    1932: invokestatic  #298                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
    1935: pop
    1936: goto          1572
    1939: aload         30
    1941: checkcast     #80                 // class java/util/List
    1944: nop
    1945: astore        27
    1947: iconst_0
    1948: istore        28
    1950: aload         21
    1952: aload         27
    1954: checkcast     #54                 // class java/util/Collection
    1957: invokeinterface #279,  2          // InterfaceMethod java/util/List.addAll:(Ljava/util/Collection;)Z
    1962: pop
    1963: aload         21
    1965: astore        10
    1967: new           #201                // class java/lang/StringBuilder
    1970: dup
    1971: invokespecial #202                // Method java/lang/StringBuilder."<init>":()V
    1974: getstatic     #282                // Field lettersInverted:Ljava/util/Map;
    1977: iload         18
    1979: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
    1982: invokeinterface #97,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    1987: invokevirtual #285                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    1990: ldc_w         #300                // String  -> Current solution
    1993: invokevirtual #215                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
    1996: aload         10
    1998: invokeinterface #234,  1          // InterfaceMethod java/util/List.size:()I
    2003: invokevirtual #218                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
    2006: invokevirtual #222                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
    2009: getstatic     #189                // Field java/lang/System.out:Ljava/io/PrintStream;
    2012: swap
    2013: invokevirtual #194                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    2016: nop
    2017: nop
    2018: goto          1240
    2021: nop
    2022: aload         10
    2024: checkcast     #48                 // class java/lang/Iterable
    2027: astore        12
    2029: nop
    2030: iconst_0
    2031: istore        13
    2033: aload         12
    2035: astore        14
    2037: new           #50                 // class java/util/ArrayList
    2040: dup
    2041: invokespecial #52                 // Method java/util/ArrayList."<init>":()V
    2044: checkcast     #54                 // class java/util/Collection
    2047: astore        16
    2049: iconst_0
    2050: istore        17
    2052: aload         14
    2054: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    2059: astore        18
    2061: aload         18
    2063: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    2068: ifeq          2113
    2071: aload         18
    2073: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    2078: astore        19
    2080: aload         19
    2082: checkcast     #238                // class WordGroup
    2085: astore        20
    2087: iconst_0
    2088: istore        21
    2090: aload         20
    2092: aload         6
    2094: invokevirtual #303                // Method WordGroup.toWords:(Ljava/util/Map;)Ljava/util/List;
    2097: checkcast     #48                 // class java/lang/Iterable
    2100: astore        20
    2102: aload         16
    2104: aload         20
    2106: invokestatic  #298                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
    2109: pop
    2110: goto          2061
    2113: aload         16
    2115: checkcast     #80                 // class java/util/List
    2118: nop
    2119: checkcast     #48                 // class java/lang/Iterable
    2122: astore        12
    2124: nop
    2125: iconst_0
    2126: istore        13
    2128: aload         12
    2130: astore        14
    2132: aload         14
    2134: astore        16
    2136: iconst_0
    2137: istore        17
    2139: aload         16
    2141: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    2146: astore        18
    2148: aload         18
    2150: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    2155: ifeq          2211
    2158: aload         18
    2160: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    2165: astore        19
    2167: aload         19
    2169: checkcast     #80                 // class java/util/List
    2172: astore        20
    2174: iconst_0
    2175: istore        21
    2177: aload         20
    2179: checkcast     #48                 // class java/lang/Iterable
    2182: ldc_w         #305                // String
    2185: checkcast     #307                // class java/lang/CharSequence
    2188: aconst_null
    2189: aconst_null
    2190: iconst_0
    2191: aconst_null
    2192: aconst_null
    2193: bipush        62
    2195: aconst_null
    2196: invokestatic  #311                // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
    2199: getstatic     #189                // Field java/lang/System.out:Ljava/io/PrintStream;
    2202: swap
    2203: invokevirtual #194                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    2206: nop
    2207: nop
    2208: goto          2148
    2211: aload         14
    2213: nop
    2214: checkcast     #80                 // class java/util/List
    2217: astore        11
    2219: getstatic     #189                // Field java/lang/System.out:Ljava/io/PrintStream;
    2222: invokevirtual #313                // Method java/io/PrintStream.println:()V
    2225: new           #201                // class java/lang/StringBuilder
    2228: dup
    2229: invokespecial #202                // Method java/lang/StringBuilder."<init>":()V
    2232: ldc_w         #315                // String Total possibilities including anagrams:
    2235: invokevirtual #215                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
    2238: aload         11
    2240: invokeinterface #234,  1          // InterfaceMethod java/util/List.size:()I
    2245: invokevirtual #218                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
    2248: invokevirtual #222                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
    2251: getstatic     #189                // Field java/lang/System.out:Ljava/io/PrintStream;
    2254: swap
    2255: invokevirtual #194                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    2258: getstatic     #189                // Field java/lang/System.out:Ljava/io/PrintStream;
    2261: invokevirtual #313                // Method java/io/PrintStream.println:()V
    2264: new           #201                // class java/lang/StringBuilder
    2267: dup
    2268: invokespecial #202                // Method java/lang/StringBuilder."<init>":()V
    2271: ldc_w         #317                // String Total possibilities excluding anagrams:
    2274: invokevirtual #215                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
    2277: aload         10
    2279: invokeinterface #234,  1          // InterfaceMethod java/util/List.size:()I
    2284: invokevirtual #218                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
    2287: invokevirtual #222                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
    2290: getstatic     #189                // Field java/lang/System.out:Ljava/io/PrintStream;
    2293: swap
    2294: invokevirtual #194                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    2297: nop
    2298: nop
    2299: invokestatic  #12                 // Method java/lang/System.currentTimeMillis:()J
    2302: lload_3
    2303: lsub
    2304: lstore_0
    2305: new           #201                // class java/lang/StringBuilder
    2308: dup
    2309: invokespecial #202                // Method java/lang/StringBuilder."<init>":()V
    2312: lload_0
    2313: l2d
    2314: ldc2_w        #318                // double 1000.0d
    2317: ddiv
    2318: invokevirtual #322                // Method java/lang/StringBuilder.append:(D)Ljava/lang/StringBuilder;
    2321: ldc_w         #324                // String  seconds
    2324: invokevirtual #215                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
    2327: invokevirtual #222                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
    2330: getstatic     #189                // Field java/lang/System.out:Ljava/io/PrintStream;
    2333: swap
    2334: invokevirtual #194                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    2337: return

  public static final int merge(java.lang.Iterable<Signature>);
    Code:
       0: aload_0
       1: ldc_w         #433                // String <this>
       4: invokestatic  #437                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: astore_1
       9: getstatic     #246                // Field Signature.Companion:LSignature$Companion;
      12: invokevirtual #251                // Method Signature$Companion."getEmpty-MrUGAVo":()I
      15: istore_2
      16: iconst_0
      17: istore_3
      18: iload_2
      19: istore        4
      21: aload_1
      22: invokeinterface #58,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      27: astore        5
      29: aload         5
      31: invokeinterface #64,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      36: ifeq          77
      39: aload         5
      41: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      46: astore        6
      48: iload         4
      50: aload         6
      52: checkcast     #16                 // class Signature
      55: invokevirtual #117                // Method Signature."unbox-impl":()I
      58: istore        7
      60: istore        8
      62: iconst_0
      63: istore        9
      65: iload         8
      67: iload         7
      69: invokestatic  #440                // Method Signature."plus-VbpjEXU":(II)I
      72: istore        4
      74: goto          29
      77: iload         4
      79: ireturn

  public static final java.util.Map<java.lang.Character, Signature> getLetters();
    Code:
       0: getstatic     #129                // Field letters:Ljava/util/Map;
       3: areturn

  public static final java.util.Map<Signature, java.lang.Character> getLettersInverted();
    Code:
       0: getstatic     #282                // Field lettersInverted:Ljava/util/Map;
       3: areturn

  public static final int toSignature(java.lang.String);
    Code:
       0: aload_0
       1: ldc_w         #433                // String <this>
       4: invokestatic  #437                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: checkcast     #307                // class java/lang/CharSequence
      11: astore_1
      12: iconst_0
      13: istore_2
      14: aload_1
      15: astore_3
      16: new           #50                 // class java/util/ArrayList
      19: dup
      20: aload_1
      21: invokeinterface #448,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      26: invokespecial #291                // Method java/util/ArrayList."<init>":(I)V
      29: checkcast     #54                 // class java/util/Collection
      32: astore        4
      34: iconst_0
      35: istore        5
      37: iconst_0
      38: istore        6
      40: iload         6
      42: aload_3
      43: invokeinterface #448,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      48: if_icmpge     113
      51: aload_3
      52: iload         6
      54: invokeinterface #451,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
      59: istore        7
      61: aload         4
      63: iload         7
      65: istore        8
      67: astore        10
      69: iconst_0
      70: istore        9
      72: getstatic     #129                // Field letters:Ljava/util/Map;
      75: iload         8
      77: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      80: invokeinterface #97,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      85: dup
      86: invokestatic  #30                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      89: checkcast     #16                 // class Signature
      92: invokevirtual #117                // Method Signature."unbox-impl":()I
      95: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
      98: aload         10
     100: swap
     101: invokeinterface #78,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     106: pop
     107: iinc          6, 1
     110: goto          40
     113: aload         4
     115: checkcast     #80                 // class java/util/List
     118: nop
     119: checkcast     #48                 // class java/lang/Iterable
     122: invokestatic  #269                // Method merge:(Ljava/lang/Iterable;)I
     125: ireturn

  public static void main(java.lang.String[]);
    Code:
       0: invokestatic  #463                // Method main:()V
       3: return

  static {};
    Code:
       0: bipush        26
       2: anewarray     #468                // class kotlin/Pair
       5: astore_0
       6: aload_0
       7: iconst_0
       8: bipush        97
      10: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      13: iconst_1
      14: invokestatic  #471                // Method Signature."constructor-impl":(I)I
      17: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
      20: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      23: aastore
      24: aload_0
      25: iconst_1
      26: bipush        98
      28: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      31: iconst_2
      32: invokestatic  #471                // Method Signature."constructor-impl":(I)I
      35: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
      38: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      41: aastore
      42: aload_0
      43: iconst_2
      44: bipush        99
      46: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      49: iconst_4
      50: invokestatic  #471                // Method Signature."constructor-impl":(I)I
      53: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
      56: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      59: aastore
      60: aload_0
      61: iconst_3
      62: bipush        100
      64: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      67: bipush        8
      69: invokestatic  #471                // Method Signature."constructor-impl":(I)I
      72: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
      75: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      78: aastore
      79: aload_0
      80: iconst_4
      81: bipush        101
      83: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      86: bipush        16
      88: invokestatic  #471                // Method Signature."constructor-impl":(I)I
      91: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
      94: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      97: aastore
      98: aload_0
      99: iconst_5
     100: bipush        102
     102: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     105: bipush        32
     107: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     110: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     113: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     116: aastore
     117: aload_0
     118: bipush        6
     120: bipush        103
     122: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     125: bipush        64
     127: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     130: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     133: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     136: aastore
     137: aload_0
     138: bipush        7
     140: bipush        104
     142: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     145: sipush        128
     148: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     151: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     154: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     157: aastore
     158: aload_0
     159: bipush        8
     161: bipush        105
     163: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     166: sipush        256
     169: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     172: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     175: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     178: aastore
     179: aload_0
     180: bipush        9
     182: bipush        106
     184: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     187: sipush        512
     190: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     193: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     196: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     199: aastore
     200: aload_0
     201: bipush        10
     203: bipush        107
     205: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     208: sipush        1024
     211: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     214: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     217: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     220: aastore
     221: aload_0
     222: bipush        11
     224: bipush        108
     226: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     229: sipush        2048
     232: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     235: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     238: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     241: aastore
     242: aload_0
     243: bipush        12
     245: bipush        109
     247: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     250: sipush        4096
     253: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     256: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     259: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     262: aastore
     263: aload_0
     264: bipush        13
     266: bipush        110
     268: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     271: sipush        8192
     274: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     277: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     280: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     283: aastore
     284: aload_0
     285: bipush        14
     287: bipush        111
     289: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     292: sipush        16384
     295: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     298: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     301: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     304: aastore
     305: aload_0
     306: bipush        15
     308: bipush        112
     310: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     313: ldc_w         #478                // int 32768
     316: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     319: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     322: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     325: aastore
     326: aload_0
     327: bipush        16
     329: bipush        113
     331: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     334: ldc_w         #479                // int 65536
     337: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     340: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     343: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     346: aastore
     347: aload_0
     348: bipush        17
     350: bipush        114
     352: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     355: ldc_w         #480                // int 131072
     358: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     361: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     364: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     367: aastore
     368: aload_0
     369: bipush        18
     371: bipush        115
     373: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     376: ldc_w         #481                // int 262144
     379: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     382: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     385: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     388: aastore
     389: aload_0
     390: bipush        19
     392: bipush        116
     394: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     397: ldc_w         #482                // int 524288
     400: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     403: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     406: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     409: aastore
     410: aload_0
     411: bipush        20
     413: bipush        117
     415: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     418: ldc_w         #483                // int 1048576
     421: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     424: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     427: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     430: aastore
     431: aload_0
     432: bipush        21
     434: bipush        118
     436: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     439: ldc_w         #484                // int 2097152
     442: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     445: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     448: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     451: aastore
     452: aload_0
     453: bipush        22
     455: bipush        119
     457: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     460: ldc_w         #485                // int 4194304
     463: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     466: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     469: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     472: aastore
     473: aload_0
     474: bipush        23
     476: bipush        120
     478: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     481: ldc_w         #486                // int 8388608
     484: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     487: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     490: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     493: aastore
     494: aload_0
     495: bipush        24
     497: bipush        121
     499: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     502: ldc_w         #487                // int 16777216
     505: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     508: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     511: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     514: aastore
     515: aload_0
     516: bipush        25
     518: bipush        122
     520: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     523: ldc_w         #488                // int 33554432
     526: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     529: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     532: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     535: aastore
     536: aload_0
     537: invokestatic  #492                // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;
     540: putstatic     #129                // Field letters:Ljava/util/Map;
     543: bipush        26
     545: anewarray     #468                // class kotlin/Pair
     548: astore_0
     549: aload_0
     550: iconst_0
     551: iconst_1
     552: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     555: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     558: bipush        97
     560: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     563: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     566: aastore
     567: aload_0
     568: iconst_1
     569: iconst_2
     570: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     573: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     576: bipush        98
     578: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     581: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     584: aastore
     585: aload_0
     586: iconst_2
     587: iconst_4
     588: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     591: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     594: bipush        99
     596: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     599: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     602: aastore
     603: aload_0
     604: iconst_3
     605: bipush        8
     607: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     610: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     613: bipush        100
     615: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     618: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     621: aastore
     622: aload_0
     623: iconst_4
     624: bipush        16
     626: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     629: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     632: bipush        101
     634: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     637: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     640: aastore
     641: aload_0
     642: iconst_5
     643: bipush        32
     645: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     648: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     651: bipush        102
     653: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     656: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     659: aastore
     660: aload_0
     661: bipush        6
     663: bipush        64
     665: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     668: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     671: bipush        103
     673: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     676: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     679: aastore
     680: aload_0
     681: bipush        7
     683: sipush        128
     686: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     689: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     692: bipush        104
     694: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     697: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     700: aastore
     701: aload_0
     702: bipush        8
     704: sipush        256
     707: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     710: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     713: bipush        105
     715: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     718: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     721: aastore
     722: aload_0
     723: bipush        9
     725: sipush        512
     728: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     731: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     734: bipush        106
     736: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     739: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     742: aastore
     743: aload_0
     744: bipush        10
     746: sipush        1024
     749: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     752: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     755: bipush        107
     757: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     760: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     763: aastore
     764: aload_0
     765: bipush        11
     767: sipush        2048
     770: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     773: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     776: bipush        108
     778: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     781: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     784: aastore
     785: aload_0
     786: bipush        12
     788: sipush        4096
     791: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     794: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     797: bipush        109
     799: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     802: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     805: aastore
     806: aload_0
     807: bipush        13
     809: sipush        8192
     812: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     815: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     818: bipush        110
     820: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     823: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     826: aastore
     827: aload_0
     828: bipush        14
     830: sipush        16384
     833: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     836: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     839: bipush        111
     841: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     844: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     847: aastore
     848: aload_0
     849: bipush        15
     851: ldc_w         #478                // int 32768
     854: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     857: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     860: bipush        112
     862: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     865: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     868: aastore
     869: aload_0
     870: bipush        16
     872: ldc_w         #479                // int 65536
     875: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     878: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     881: bipush        113
     883: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     886: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     889: aastore
     890: aload_0
     891: bipush        17
     893: ldc_w         #480                // int 131072
     896: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     899: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     902: bipush        114
     904: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     907: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     910: aastore
     911: aload_0
     912: bipush        18
     914: ldc_w         #481                // int 262144
     917: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     920: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     923: bipush        115
     925: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     928: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     931: aastore
     932: aload_0
     933: bipush        19
     935: ldc_w         #482                // int 524288
     938: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     941: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     944: bipush        116
     946: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     949: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     952: aastore
     953: aload_0
     954: bipush        20
     956: ldc_w         #483                // int 1048576
     959: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     962: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     965: bipush        117
     967: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     970: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     973: aastore
     974: aload_0
     975: bipush        21
     977: ldc_w         #484                // int 2097152
     980: invokestatic  #471                // Method Signature."constructor-impl":(I)I
     983: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
     986: bipush        118
     988: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     991: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     994: aastore
     995: aload_0
     996: bipush        22
     998: ldc_w         #485                // int 4194304
    1001: invokestatic  #471                // Method Signature."constructor-impl":(I)I
    1004: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
    1007: bipush        119
    1009: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
    1012: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
    1015: aastore
    1016: aload_0
    1017: bipush        23
    1019: ldc_w         #486                // int 8388608
    1022: invokestatic  #471                // Method Signature."constructor-impl":(I)I
    1025: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
    1028: bipush        120
    1030: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
    1033: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
    1036: aastore
    1037: aload_0
    1038: bipush        24
    1040: ldc_w         #487                // int 16777216
    1043: invokestatic  #471                // Method Signature."constructor-impl":(I)I
    1046: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
    1049: bipush        121
    1051: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
    1054: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
    1057: aastore
    1058: aload_0
    1059: bipush        25
    1061: ldc_w         #488                // int 33554432
    1064: invokestatic  #471                // Method Signature."constructor-impl":(I)I
    1067: invokestatic  #93                 // Method Signature."box-impl":(I)LSignature;
    1070: bipush        122
    1072: invokestatic  #456                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
    1075: invokestatic  #477                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
    1078: aastore
    1079: aload_0
    1080: invokestatic  #492                // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;
    1083: putstatic     #282                // Field lettersInverted:Ljava/util/Map;
    1086: return
}


/*

Enlace al problema:
    https://leetcode.com/problems/unique-paths-ii/

La solución se encuentra dentro de la función `uniquePathsWithObstacles`, el resto del código es para
ejecutarlo de manera local.

Explanation:

    Given the grid:

          [0,0,0]
          [0,1,0]
          [0,0,0]

    Initial information:
        *) We are at position (0,0) and the target is (2,2)
        *) Inside the grid there are obstacles (1's)

    Question:
        How many paths can we find from initial position to target position?

    Solution
    --------
        1) Add a new `row` and `column` to the grid.

                  [I,0,0,0]
                  [0,X,0,0]
                  [0,0,T,0]
                  [0,0,0,0]

        2) Check if initial position is and obstacle, if true assign `0` otherwise `1`

                  [1,0,0,0]
                  [0,X,0,0]
                  [0,0,T,0]
                  [0,0,0,0]

        3) Now check for the first `row` and the first `column` and if is and
          obstacle assign `0` otherwise the previous value (in this case just `row` or `column`)

                  [1,1,1,1]
                  [1,X,0,0]
                  [1,0,T,0]
                  [1,0,0,0]

        4) Finally we pre-calculate all the other values to the target.
           To do this we need to assign to the current value (x,y) the sum
           of the paths that can lead us to the `target` which are:
           (row, col-1) and (row-1, col)

            * If there is an obstacle in the current position (x,y), we assign `0`

                  [1,1,1,1]
                  [1,0,1,2]
                  [1,1,2,4]
                  [1,2,4,8]

    Time complexity: O(m*n)

*/

class Solution {
    fun uniquePathsWithObstacles(obstacleGrid: Array<IntArray>): Int {
        val rows = obstacleGrid.size
        val cols = obstacleGrid[0].size

        val grid = Array(rows + 1) { IntArray(cols + 1) { 0 } }

        grid[0][0] = if (obstacleGrid[0][0] == 0) 1 else 0

        for (i in 1 until rows) if (obstacleGrid[i][0] == 0) grid[i][0] = grid[i - 1][0]
        for (i in 1 until cols) if (obstacleGrid[0][i] == 0) grid[0][i] = grid[0][i - 1]

        for (i in 1 until rows) {
            for (j in 1 until cols) {
                grid[i][j] = if (obstacleGrid[i][j] == 0) grid[i - 1][j] + grid[i][j - 1] else 0
            }
        }
        return grid[rows - 1][cols - 1]
    }
}

fun main() {
    // Class for Solution
    val solution = Solution()

    // Test #1: Input grid
    val grid = arrayOf(
        intArrayOf(0, 0, 0),
        intArrayOf(0, 1, 0),
        intArrayOf(0, 0, 0)
    )

    // Test #1: Output solution
    println(solution.uniquePathsWithObstacles(grid))
}

Compiled from "UniquePathsTwo.kt"
public final class UniquePathsTwoKt {
  public static final void main();
    Code:
       0: new           #8                  // class Solution
       3: dup
       4: invokespecial #11                 // Method Solution."<init>":()V
       7: astore_0
       8: iconst_3
       9: anewarray     #13                 // class "[I"
      12: astore_2
      13: aload_2
      14: iconst_0
      15: iconst_3
      16: newarray       int
      18: astore_3
      19: aload_3
      20: iconst_0
      21: iconst_0
      22: iastore
      23: aload_3
      24: iconst_1
      25: iconst_0
      26: iastore
      27: aload_3
      28: iconst_2
      29: iconst_0
      30: iastore
      31: aload_3
      32: aastore
      33: aload_2
      34: iconst_1
      35: iconst_3
      36: newarray       int
      38: astore_3
      39: aload_3
      40: iconst_0
      41: iconst_0
      42: iastore
      43: aload_3
      44: iconst_1
      45: iconst_1
      46: iastore
      47: aload_3
      48: iconst_2
      49: iconst_0
      50: iastore
      51: aload_3
      52: aastore
      53: aload_2
      54: iconst_2
      55: iconst_3
      56: newarray       int
      58: astore_3
      59: aload_3
      60: iconst_0
      61: iconst_0
      62: iastore
      63: aload_3
      64: iconst_1
      65: iconst_0
      66: iastore
      67: aload_3
      68: iconst_2
      69: iconst_0
      70: iastore
      71: aload_3
      72: aastore
      73: aload_2
      74: astore_1
      75: aload_0
      76: aload_1
      77: invokevirtual #17                 // Method Solution.uniquePathsWithObstacles:([[I)I
      80: istore_2
      81: getstatic     #23                 // Field java/lang/System.out:Ljava/io/PrintStream;
      84: iload_2
      85: invokevirtual #29                 // Method java/io/PrintStream.println:(I)V
      88: return

  public static void main(java.lang.String[]);
    Code:
       0: invokestatic  #36                 // Method main:()V
       3: return
}