package net.rafaeltoledo.kotlin.advent

class Day02 {

  val validRound = Round(red = 12, green = 13, blue = 14)

  fun invoke(input: List<String>): Int {
    val games = input.map { it.toGame() }

    return games.filter { it.isValid() }.sumOf { it.id }
  }

  fun invoke2(input: List<String>): Int {
    val games = input.map { it.toGame() }

    return games.map { it.rounds.optimal() }.sumOf { it.red * it.green * it.blue }
  }

  private fun Game.isValid(): Boolean {
    return rounds.map { it.isValid() }.reduce { acc, value -> acc && value }
  }

  private fun Round.isValid(): Boolean {
    return red <= validRound.red
      && blue <= validRound.blue
      && green <= validRound.green
  }

  private fun String.toGame(): Game {
    val parts = split(":")
    val id = parts.first().replace("Game ", "").toInt()
    val rounds = parts.last().split(";").map { it.toRound() }
    return Game(id = id, rounds = rounds)
  }

  private fun String.toRound(): Round {
    val parts = split(",").map { it.trim() }
    return Round(
      red = parts.findAndParse("red"),
      blue = parts.findAndParse("blue"),
      green = parts.findAndParse("green"),
    )
  }

  private fun List<String>.findAndParse(key: String): Int {
    return find { it.endsWith(key) }?.replace(key, "")?.trim()?.toInt() ?: 0
  }
}

private fun List<Round>.optimal(): Round {
  return Round(
    red = maxOf { it.red },
    green = maxOf { it.green },
    blue = maxOf { it.blue },
  )
}

data class Round(
  val red: Int,
  val blue: Int,
  val green: Int,
)

data class Game(
  val id: Int,
  val rounds: List<Round>,
)

Compiled from "Day02.kt"
public final class net.rafaeltoledo.kotlin.advent.Day02Kt {
  private static final net.rafaeltoledo.kotlin.advent.Round optimal(java.util.List<net.rafaeltoledo.kotlin.advent.Round>);
    Code:
       0: aload_0
       1: checkcast     #9                  // class java/lang/Iterable
       4: invokeinterface #13,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
       9: astore_3
      10: aload_3
      11: invokeinterface #19,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      16: ifne          27
      19: new           #21                 // class java/util/NoSuchElementException
      22: dup
      23: invokespecial #25                 // Method java/util/NoSuchElementException."<init>":()V
      26: athrow
      27: aload_3
      28: invokeinterface #29,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      33: checkcast     #31                 // class net/rafaeltoledo/kotlin/advent/Round
      36: astore        4
      38: iconst_0
      39: istore        5
      41: aload         4
      43: invokevirtual #35                 // Method net/rafaeltoledo/kotlin/advent/Round.getRed:()I
      46: istore        4
      48: aload_3
      49: invokeinterface #19,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      54: ifeq          92
      57: aload_3
      58: invokeinterface #29,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      63: checkcast     #31                 // class net/rafaeltoledo/kotlin/advent/Round
      66: astore        5
      68: iconst_0
      69: istore        6
      71: aload         5
      73: invokevirtual #35                 // Method net/rafaeltoledo/kotlin/advent/Round.getRed:()I
      76: istore        5
      78: iload         4
      80: iload         5
      82: if_icmpge     48
      85: iload         5
      87: istore        4
      89: goto          48
      92: iload         4
      94: istore_1
      95: aload_0
      96: checkcast     #9                  // class java/lang/Iterable
      99: invokeinterface #13,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     104: astore        4
     106: aload         4
     108: invokeinterface #19,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     113: ifne          124
     116: new           #21                 // class java/util/NoSuchElementException
     119: dup
     120: invokespecial #25                 // Method java/util/NoSuchElementException."<init>":()V
     123: athrow
     124: aload         4
     126: invokeinterface #29,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     131: checkcast     #31                 // class net/rafaeltoledo/kotlin/advent/Round
     134: astore        5
     136: iconst_0
     137: istore        6
     139: aload         5
     141: invokevirtual #38                 // Method net/rafaeltoledo/kotlin/advent/Round.getGreen:()I
     144: istore        5
     146: aload         4
     148: invokeinterface #19,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     153: ifeq          192
     156: aload         4
     158: invokeinterface #29,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     163: checkcast     #31                 // class net/rafaeltoledo/kotlin/advent/Round
     166: astore        6
     168: iconst_0
     169: istore        7
     171: aload         6
     173: invokevirtual #38                 // Method net/rafaeltoledo/kotlin/advent/Round.getGreen:()I
     176: istore        6
     178: iload         5
     180: iload         6
     182: if_icmpge     146
     185: iload         6
     187: istore        5
     189: goto          146
     192: iload         5
     194: istore_2
     195: aload_0
     196: checkcast     #9                  // class java/lang/Iterable
     199: invokeinterface #13,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     204: astore        5
     206: aload         5
     208: invokeinterface #19,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     213: ifne          224
     216: new           #21                 // class java/util/NoSuchElementException
     219: dup
     220: invokespecial #25                 // Method java/util/NoSuchElementException."<init>":()V
     223: athrow
     224: aload         5
     226: invokeinterface #29,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     231: checkcast     #31                 // class net/rafaeltoledo/kotlin/advent/Round
     234: astore        6
     236: iconst_0
     237: istore        7
     239: aload         6
     241: invokevirtual #41                 // Method net/rafaeltoledo/kotlin/advent/Round.getBlue:()I
     244: istore        6
     246: aload         5
     248: invokeinterface #19,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     253: ifeq          292
     256: aload         5
     258: invokeinterface #29,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     263: checkcast     #31                 // class net/rafaeltoledo/kotlin/advent/Round
     266: astore        7
     268: iconst_0
     269: istore        8
     271: aload         7
     273: invokevirtual #41                 // Method net/rafaeltoledo/kotlin/advent/Round.getBlue:()I
     276: istore        7
     278: iload         6
     280: iload         7
     282: if_icmpge     246
     285: iload         7
     287: istore        6
     289: goto          246
     292: iload         6
     294: istore_3
     295: new           #31                 // class net/rafaeltoledo/kotlin/advent/Round
     298: dup
     299: iload_1
     300: iload_3
     301: iload_2
     302: invokespecial #44                 // Method net/rafaeltoledo/kotlin/advent/Round."<init>":(III)V
     305: areturn

  public static final net.rafaeltoledo.kotlin.advent.Round access$optimal(java.util.List);
    Code:
       0: aload_0
       1: invokestatic  #57                 // Method optimal:(Ljava/util/List;)Lnet/rafaeltoledo/kotlin/advent/Round;
       4: areturn
}

Compiled from "Day02.kt"
public final class net.rafaeltoledo.kotlin.advent.Day02 {
  private final net.rafaeltoledo.kotlin.advent.Round validRound;

  public net.rafaeltoledo.kotlin.advent.Day02();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: aload_0
       5: new           #10                 // class net/rafaeltoledo/kotlin/advent/Round
       8: dup
       9: bipush        12
      11: bipush        14
      13: bipush        13
      15: invokespecial #13                 // Method net/rafaeltoledo/kotlin/advent/Round."<init>":(III)V
      18: putfield      #17                 // Field validRound:Lnet/rafaeltoledo/kotlin/advent/Round;
      21: return

  public final net.rafaeltoledo.kotlin.advent.Round getValidRound();
    Code:
       0: aload_0
       1: getfield      #17                 // Field validRound:Lnet/rafaeltoledo/kotlin/advent/Round;
       4: areturn

  public final int invoke(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #27                 // String input
       3: invokestatic  #33                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #35                 // class java/lang/Iterable
      10: astore_3
      11: iconst_0
      12: istore        4
      14: aload_3
      15: astore        5
      17: new           #37                 // class java/util/ArrayList
      20: dup
      21: aload_3
      22: bipush        10
      24: invokestatic  #43                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      27: invokespecial #46                 // Method java/util/ArrayList."<init>":(I)V
      30: checkcast     #48                 // class java/util/Collection
      33: astore        6
      35: iconst_0
      36: istore        7
      38: aload         5
      40: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      45: astore        8
      47: aload         8
      49: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      54: ifeq          98
      57: aload         8
      59: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      64: astore        9
      66: aload         6
      68: aload         9
      70: checkcast     #64                 // class java/lang/String
      73: astore        10
      75: astore        12
      77: iconst_0
      78: istore        11
      80: aload_0
      81: aload         10
      83: invokespecial #68                 // Method toGame:(Ljava/lang/String;)Lnet/rafaeltoledo/kotlin/advent/Game;
      86: aload         12
      88: swap
      89: invokeinterface #72,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      94: pop
      95: goto          47
      98: aload         6
     100: checkcast     #74                 // class java/util/List
     103: nop
     104: astore_2
     105: aload_2
     106: checkcast     #35                 // class java/lang/Iterable
     109: astore_3
     110: iconst_0
     111: istore        4
     113: aload_3
     114: astore        5
     116: new           #37                 // class java/util/ArrayList
     119: dup
     120: invokespecial #75                 // Method java/util/ArrayList."<init>":()V
     123: checkcast     #48                 // class java/util/Collection
     126: astore        6
     128: iconst_0
     129: istore        7
     131: aload         5
     133: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     138: astore        8
     140: aload         8
     142: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     147: ifeq          191
     150: aload         8
     152: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     157: astore        9
     159: aload         9
     161: checkcast     #77                 // class net/rafaeltoledo/kotlin/advent/Game
     164: astore        10
     166: iconst_0
     167: istore        11
     169: aload_0
     170: aload         10
     172: invokespecial #81                 // Method isValid:(Lnet/rafaeltoledo/kotlin/advent/Game;)Z
     175: ifeq          140
     178: aload         6
     180: aload         9
     182: invokeinterface #72,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     187: pop
     188: goto          140
     191: aload         6
     193: checkcast     #74                 // class java/util/List
     196: nop
     197: checkcast     #35                 // class java/lang/Iterable
     200: astore_3
     201: iconst_0
     202: istore        4
     204: aload_3
     205: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     210: astore        5
     212: aload         5
     214: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     219: ifeq          262
     222: aload         5
     224: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     229: astore        6
     231: iload         4
     233: aload         6
     235: checkcast     #77                 // class net/rafaeltoledo/kotlin/advent/Game
     238: astore        7
     240: istore        12
     242: iconst_0
     243: istore        8
     245: aload         7
     247: invokevirtual #85                 // Method net/rafaeltoledo/kotlin/advent/Game.getId:()I
     250: istore        13
     252: iload         12
     254: iload         13
     256: iadd
     257: istore        4
     259: goto          212
     262: iload         4
     264: ireturn

  public final int invoke2(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #27                 // String input
       3: invokestatic  #33                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #35                 // class java/lang/Iterable
      10: astore_3
      11: iconst_0
      12: istore        4
      14: aload_3
      15: astore        5
      17: new           #37                 // class java/util/ArrayList
      20: dup
      21: aload_3
      22: bipush        10
      24: invokestatic  #43                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      27: invokespecial #46                 // Method java/util/ArrayList."<init>":(I)V
      30: checkcast     #48                 // class java/util/Collection
      33: astore        6
      35: iconst_0
      36: istore        7
      38: aload         5
      40: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      45: astore        8
      47: aload         8
      49: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      54: ifeq          98
      57: aload         8
      59: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      64: astore        9
      66: aload         6
      68: aload         9
      70: checkcast     #64                 // class java/lang/String
      73: astore        10
      75: astore        12
      77: iconst_0
      78: istore        11
      80: aload_0
      81: aload         10
      83: invokespecial #68                 // Method toGame:(Ljava/lang/String;)Lnet/rafaeltoledo/kotlin/advent/Game;
      86: aload         12
      88: swap
      89: invokeinterface #72,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      94: pop
      95: goto          47
      98: aload         6
     100: checkcast     #74                 // class java/util/List
     103: nop
     104: astore_2
     105: aload_2
     106: checkcast     #35                 // class java/lang/Iterable
     109: astore_3
     110: iconst_0
     111: istore        4
     113: aload_3
     114: astore        5
     116: new           #37                 // class java/util/ArrayList
     119: dup
     120: aload_3
     121: bipush        10
     123: invokestatic  #43                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     126: invokespecial #46                 // Method java/util/ArrayList."<init>":(I)V
     129: checkcast     #48                 // class java/util/Collection
     132: astore        6
     134: iconst_0
     135: istore        7
     137: aload         5
     139: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     144: astore        8
     146: aload         8
     148: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     153: ifeq          199
     156: aload         8
     158: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     163: astore        9
     165: aload         6
     167: aload         9
     169: checkcast     #77                 // class net/rafaeltoledo/kotlin/advent/Game
     172: astore        10
     174: astore        12
     176: iconst_0
     177: istore        11
     179: aload         10
     181: invokevirtual #113                // Method net/rafaeltoledo/kotlin/advent/Game.getRounds:()Ljava/util/List;
     184: invokestatic  #119                // Method net/rafaeltoledo/kotlin/advent/Day02Kt.access$optimal:(Ljava/util/List;)Lnet/rafaeltoledo/kotlin/advent/Round;
     187: aload         12
     189: swap
     190: invokeinterface #72,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     195: pop
     196: goto          146
     199: aload         6
     201: checkcast     #74                 // class java/util/List
     204: nop
     205: checkcast     #35                 // class java/lang/Iterable
     208: astore_3
     209: iconst_0
     210: istore        4
     212: aload_3
     213: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     218: astore        5
     220: aload         5
     222: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     227: ifeq          282
     230: aload         5
     232: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     237: astore        6
     239: iload         4
     241: aload         6
     243: checkcast     #10                 // class net/rafaeltoledo/kotlin/advent/Round
     246: astore        7
     248: istore        12
     250: iconst_0
     251: istore        8
     253: aload         7
     255: invokevirtual #122                // Method net/rafaeltoledo/kotlin/advent/Round.getRed:()I
     258: aload         7
     260: invokevirtual #125                // Method net/rafaeltoledo/kotlin/advent/Round.getGreen:()I
     263: imul
     264: aload         7
     266: invokevirtual #128                // Method net/rafaeltoledo/kotlin/advent/Round.getBlue:()I
     269: imul
     270: istore        13
     272: iload         12
     274: iload         13
     276: iadd
     277: istore        4
     279: goto          220
     282: iload         4
     284: ireturn

  private final boolean isValid(net.rafaeltoledo.kotlin.advent.Game);
    Code:
       0: aload_1
       1: invokevirtual #113                // Method net/rafaeltoledo/kotlin/advent/Game.getRounds:()Ljava/util/List;
       4: checkcast     #35                 // class java/lang/Iterable
       7: astore_2
       8: iconst_0
       9: istore_3
      10: aload_2
      11: astore        4
      13: new           #37                 // class java/util/ArrayList
      16: dup
      17: aload_2
      18: bipush        10
      20: invokestatic  #43                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      23: invokespecial #46                 // Method java/util/ArrayList."<init>":(I)V
      26: checkcast     #48                 // class java/util/Collection
      29: astore        5
      31: iconst_0
      32: istore        6
      34: aload         4
      36: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      41: astore        7
      43: aload         7
      45: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      50: ifeq          97
      53: aload         7
      55: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      60: astore        8
      62: aload         5
      64: aload         8
      66: checkcast     #10                 // class net/rafaeltoledo/kotlin/advent/Round
      69: astore        9
      71: astore        11
      73: iconst_0
      74: istore        10
      76: aload_0
      77: aload         9
      79: invokespecial #134                // Method isValid:(Lnet/rafaeltoledo/kotlin/advent/Round;)Z
      82: invokestatic  #140                // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
      85: aload         11
      87: swap
      88: invokeinterface #72,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      93: pop
      94: goto          43
      97: aload         5
      99: checkcast     #74                 // class java/util/List
     102: nop
     103: checkcast     #35                 // class java/lang/Iterable
     106: astore_2
     107: nop
     108: iconst_0
     109: istore_3
     110: aload_2
     111: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     116: astore        4
     118: aload         4
     120: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     125: ifne          138
     128: new           #142                // class java/lang/UnsupportedOperationException
     131: dup
     132: ldc           #144                // String Empty collection can\'t be reduced.
     134: invokespecial #147                // Method java/lang/UnsupportedOperationException."<init>":(Ljava/lang/String;)V
     137: athrow
     138: aload         4
     140: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     145: astore        5
     147: aload         4
     149: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     154: ifeq          208
     157: aload         5
     159: aload         4
     161: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     166: checkcast     #136                // class java/lang/Boolean
     169: invokevirtual #150                // Method java/lang/Boolean.booleanValue:()Z
     172: istore        6
     174: checkcast     #136                // class java/lang/Boolean
     177: invokevirtual #150                // Method java/lang/Boolean.booleanValue:()Z
     180: istore        7
     182: iconst_0
     183: istore        8
     185: iload         7
     187: ifeq          199
     190: iload         6
     192: ifeq          199
     195: iconst_1
     196: goto          200
     199: iconst_0
     200: invokestatic  #140                // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
     203: astore        5
     205: goto          147
     208: aload         5
     210: checkcast     #136                // class java/lang/Boolean
     213: invokevirtual #150                // Method java/lang/Boolean.booleanValue:()Z
     216: ireturn

  private final boolean isValid(net.rafaeltoledo.kotlin.advent.Round);
    Code:
       0: aload_1
       1: invokevirtual #122                // Method net/rafaeltoledo/kotlin/advent/Round.getRed:()I
       4: aload_0
       5: getfield      #17                 // Field validRound:Lnet/rafaeltoledo/kotlin/advent/Round;
       8: invokevirtual #122                // Method net/rafaeltoledo/kotlin/advent/Round.getRed:()I
      11: if_icmpgt     46
      14: aload_1
      15: invokevirtual #128                // Method net/rafaeltoledo/kotlin/advent/Round.getBlue:()I
      18: aload_0
      19: getfield      #17                 // Field validRound:Lnet/rafaeltoledo/kotlin/advent/Round;
      22: invokevirtual #128                // Method net/rafaeltoledo/kotlin/advent/Round.getBlue:()I
      25: if_icmpgt     46
      28: aload_1
      29: invokevirtual #125                // Method net/rafaeltoledo/kotlin/advent/Round.getGreen:()I
      32: aload_0
      33: getfield      #17                 // Field validRound:Lnet/rafaeltoledo/kotlin/advent/Round;
      36: invokevirtual #125                // Method net/rafaeltoledo/kotlin/advent/Round.getGreen:()I
      39: if_icmpgt     46
      42: iconst_1
      43: goto          47
      46: iconst_0
      47: ireturn

  private final net.rafaeltoledo.kotlin.advent.Game toGame(java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #163                // class java/lang/CharSequence
       4: iconst_1
       5: anewarray     #64                 // class java/lang/String
       8: astore_3
       9: aload_3
      10: iconst_0
      11: ldc           #165                // String :
      13: aastore
      14: aload_3
      15: iconst_0
      16: iconst_0
      17: bipush        6
      19: aconst_null
      20: invokestatic  #171                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      23: astore_2
      24: aload_2
      25: invokestatic  #175                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      28: checkcast     #64                 // class java/lang/String
      31: ldc           #177                // String Game
      33: ldc           #179                // String
      35: iconst_0
      36: iconst_4
      37: aconst_null
      38: invokestatic  #183                // Method kotlin/text/StringsKt.replace$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String;
      41: invokestatic  #189                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      44: istore_3
      45: aload_2
      46: invokestatic  #192                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
      49: checkcast     #163                // class java/lang/CharSequence
      52: iconst_1
      53: anewarray     #64                 // class java/lang/String
      56: astore        5
      58: aload         5
      60: iconst_0
      61: ldc           #194                // String ;
      63: aastore
      64: aload         5
      66: iconst_0
      67: iconst_0
      68: bipush        6
      70: aconst_null
      71: invokestatic  #171                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      74: checkcast     #35                 // class java/lang/Iterable
      77: astore        5
      79: iconst_0
      80: istore        6
      82: aload         5
      84: astore        7
      86: new           #37                 // class java/util/ArrayList
      89: dup
      90: aload         5
      92: bipush        10
      94: invokestatic  #43                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      97: invokespecial #46                 // Method java/util/ArrayList."<init>":(I)V
     100: checkcast     #48                 // class java/util/Collection
     103: astore        8
     105: iconst_0
     106: istore        9
     108: aload         7
     110: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     115: astore        10
     117: aload         10
     119: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     124: ifeq          168
     127: aload         10
     129: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     134: astore        11
     136: aload         8
     138: aload         11
     140: checkcast     #64                 // class java/lang/String
     143: astore        12
     145: astore        14
     147: iconst_0
     148: istore        13
     150: aload_0
     151: aload         12
     153: invokespecial #198                // Method toRound:(Ljava/lang/String;)Lnet/rafaeltoledo/kotlin/advent/Round;
     156: aload         14
     158: swap
     159: invokeinterface #72,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     164: pop
     165: goto          117
     168: aload         8
     170: checkcast     #74                 // class java/util/List
     173: nop
     174: astore        4
     176: new           #77                 // class net/rafaeltoledo/kotlin/advent/Game
     179: dup
     180: iload_3
     181: aload         4
     183: invokespecial #201                // Method net/rafaeltoledo/kotlin/advent/Game."<init>":(ILjava/util/List;)V
     186: areturn

  private final net.rafaeltoledo.kotlin.advent.Round toRound(java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #163                // class java/lang/CharSequence
       4: iconst_1
       5: anewarray     #64                 // class java/lang/String
       8: astore_3
       9: aload_3
      10: iconst_0
      11: ldc           #208                // String ,
      13: aastore
      14: aload_3
      15: iconst_0
      16: iconst_0
      17: bipush        6
      19: aconst_null
      20: invokestatic  #171                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      23: checkcast     #35                 // class java/lang/Iterable
      26: astore_3
      27: iconst_0
      28: istore        4
      30: aload_3
      31: astore        5
      33: new           #37                 // class java/util/ArrayList
      36: dup
      37: aload_3
      38: bipush        10
      40: invokestatic  #43                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      43: invokespecial #46                 // Method java/util/ArrayList."<init>":(I)V
      46: checkcast     #48                 // class java/util/Collection
      49: astore        6
      51: iconst_0
      52: istore        7
      54: aload         5
      56: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      61: astore        8
      63: aload         8
      65: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      70: ifeq          120
      73: aload         8
      75: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      80: astore        9
      82: aload         6
      84: aload         9
      86: checkcast     #64                 // class java/lang/String
      89: astore        10
      91: astore        12
      93: iconst_0
      94: istore        11
      96: aload         10
      98: checkcast     #163                // class java/lang/CharSequence
     101: invokestatic  #212                // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     104: invokevirtual #216                // Method java/lang/Object.toString:()Ljava/lang/String;
     107: nop
     108: aload         12
     110: swap
     111: invokeinterface #72,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     116: pop
     117: goto          63
     120: aload         6
     122: checkcast     #74                 // class java/util/List
     125: nop
     126: astore_2
     127: new           #10                 // class net/rafaeltoledo/kotlin/advent/Round
     130: dup
     131: aload_0
     132: aload_2
     133: ldc           #218                // String red
     135: invokespecial #222                // Method findAndParse:(Ljava/util/List;Ljava/lang/String;)I
     138: aload_0
     139: aload_2
     140: ldc           #224                // String blue
     142: invokespecial #222                // Method findAndParse:(Ljava/util/List;Ljava/lang/String;)I
     145: aload_0
     146: aload_2
     147: ldc           #226                // String green
     149: invokespecial #222                // Method findAndParse:(Ljava/util/List;Ljava/lang/String;)I
     152: invokespecial #13                 // Method net/rafaeltoledo/kotlin/advent/Round."<init>":(III)V
     155: areturn

  private final int findAndParse(java.util.List<java.lang.String>, java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #35                 // class java/lang/Iterable
       4: astore_3
       5: aload_3
       6: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      11: astore        4
      13: aload         4
      15: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      20: ifeq          59
      23: aload         4
      25: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      30: astore        5
      32: aload         5
      34: checkcast     #64                 // class java/lang/String
      37: astore        6
      39: iconst_0
      40: istore        7
      42: aload         6
      44: aload_2
      45: iconst_0
      46: iconst_2
      47: aconst_null
      48: invokestatic  #233                // Method kotlin/text/StringsKt.endsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
      51: ifeq          13
      54: aload         5
      56: goto          60
      59: aconst_null
      60: checkcast     #64                 // class java/lang/String
      63: dup
      64: ifnull        99
      67: aload_2
      68: ldc           #179                // String
      70: iconst_0
      71: iconst_4
      72: aconst_null
      73: invokestatic  #183                // Method kotlin/text/StringsKt.replace$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String;
      76: dup
      77: ifnull        99
      80: checkcast     #163                // class java/lang/CharSequence
      83: invokestatic  #212                // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
      86: invokevirtual #216                // Method java/lang/Object.toString:()Ljava/lang/String;
      89: dup
      90: ifnull        99
      93: invokestatic  #189                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      96: goto          101
      99: pop
     100: iconst_0
     101: ireturn
}


package net.rafaeltoledo.kotlin.advent

private val numbers = mapOf(
  "one" to 1,
  "two" to 2,
  "three" to 3,
  "four" to 4,
  "five" to 5,
  "six" to 6,
  "seven" to 7,
  "eight" to 8,
  "nine" to 9,
)

class Day01 {

  fun invoke(rawInput: String): Int {
    val lines = rawInput.split("\n").filter { it.isNotEmpty() }

    return lines.sumOf {
      "${
        it.findDigit(
          { str -> str.substring(1) },
          { first() },
          { startsWith(it) },
        )
      }${
        it.findDigit(
          { str -> str.substring(0, str.length - 1) },
          { last() },
          { endsWith(it) })
      }".toInt()
    }
  }
}

private fun String.findDigit(
  substring: (String) -> String,
  charPicker: String.() -> Char,
  stringEval: String.(String) -> Boolean
): String {
  var value = this
  do {
    if (value.isEmpty()) break

    val digit = value.findDigit({ charPicker() }, { stringEval(it) })
    if (digit == -1) value = substring(value)
    else return digit.toString()
  } while (true)

  return ""
}

private fun String.findDigit(
  charPicker: String.() -> Char,
  stringEval: String.(String) -> Boolean
): Int {
  if (isEmpty()) {
    return -1
  }

  if (charPicker().isDigit()) {
    return charPicker().digitToInt()
  }

  numbers.keys.forEach {
    if (stringEval(it)) return numbers.getOrDefault(it, -1)
  }

  return -1
}

Compiled from "Day01.kt"
public final class net.rafaeltoledo.kotlin.advent.Day01 {
  public net.rafaeltoledo.kotlin.advent.Day01();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final int invoke(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #15                 // String rawInput
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #23                 // class java/lang/CharSequence
      10: iconst_1
      11: anewarray     #25                 // class java/lang/String
      14: astore_3
      15: aload_3
      16: iconst_0
      17: ldc           #27                 // String \n
      19: aastore
      20: aload_3
      21: iconst_0
      22: iconst_0
      23: bipush        6
      25: aconst_null
      26: invokestatic  #33                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      29: checkcast     #35                 // class java/lang/Iterable
      32: astore_3
      33: iconst_0
      34: istore        4
      36: aload_3
      37: astore        5
      39: new           #37                 // class java/util/ArrayList
      42: dup
      43: invokespecial #38                 // Method java/util/ArrayList."<init>":()V
      46: checkcast     #40                 // class java/util/Collection
      49: astore        6
      51: iconst_0
      52: istore        7
      54: aload         5
      56: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      61: astore        8
      63: aload         8
      65: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      70: ifeq          127
      73: aload         8
      75: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      80: astore        9
      82: aload         9
      84: checkcast     #25                 // class java/lang/String
      87: astore        10
      89: iconst_0
      90: istore        11
      92: aload         10
      94: checkcast     #23                 // class java/lang/CharSequence
      97: invokeinterface #58,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     102: ifle          109
     105: iconst_1
     106: goto          110
     109: iconst_0
     110: nop
     111: ifeq          63
     114: aload         6
     116: aload         9
     118: invokeinterface #62,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     123: pop
     124: goto          63
     127: aload         6
     129: checkcast     #64                 // class java/util/List
     132: nop
     133: astore_2
     134: aload_2
     135: checkcast     #35                 // class java/lang/Iterable
     138: astore_3
     139: iconst_0
     140: istore        4
     142: aload_3
     143: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     148: astore        5
     150: aload         5
     152: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     157: ifeq          256
     160: aload         5
     162: invokeinterface #54,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     167: astore        6
     169: iload         4
     171: aload         6
     173: checkcast     #25                 // class java/lang/String
     176: astore        7
     178: istore        12
     180: iconst_0
     181: istore        8
     183: nop
     184: new           #66                 // class java/lang/StringBuilder
     187: dup
     188: invokespecial #67                 // Method java/lang/StringBuilder."<init>":()V
     191: aload         7
     193: invokedynamic #85,  0             // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
     198: invokedynamic #93,  0             // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function1;
     203: invokedynamic #105,  0            // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function2;
     208: invokestatic  #111                // Method net/rafaeltoledo/kotlin/advent/Day01Kt.access$findDigit:(Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;)Ljava/lang/String;
     211: invokevirtual #115                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     214: aload         7
     216: invokedynamic #120,  0            // InvokeDynamic #3:invoke:()Lkotlin/jvm/functions/Function1;
     221: invokedynamic #125,  0            // InvokeDynamic #4:invoke:()Lkotlin/jvm/functions/Function1;
     226: invokedynamic #130,  0            // InvokeDynamic #5:invoke:()Lkotlin/jvm/functions/Function2;
     231: invokestatic  #111                // Method net/rafaeltoledo/kotlin/advent/Day01Kt.access$findDigit:(Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;)Ljava/lang/String;
     234: invokevirtual #115                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     237: invokevirtual #134                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     240: invokestatic  #139                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     243: nop
     244: istore        13
     246: iload         12
     248: iload         13
     250: iadd
     251: istore        4
     253: goto          150
     256: iload         4
     258: ireturn

  private static final java.lang.String invoke$lambda$7$lambda$1(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #157                // String str
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: iconst_1
       8: invokevirtual #161                // Method java/lang/String.substring:(I)Ljava/lang/String;
      11: dup
      12: ldc           #163                // String substring(...)
      14: invokestatic  #166                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      17: areturn

  private static final char invoke$lambda$7$lambda$2(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #168                // String $this$findDigit
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #23                 // class java/lang/CharSequence
      10: invokestatic  #172                // Method kotlin/text/StringsKt.first:(Ljava/lang/CharSequence;)C
      13: ireturn

  private static final boolean invoke$lambda$7$lambda$3(java.lang.String, java.lang.String);
    Code:
       0: aload_0
       1: ldc           #168                // String $this$findDigit
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #173                // String it
       9: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: aload_1
      14: iconst_0
      15: iconst_2
      16: aconst_null
      17: invokestatic  #177                // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
      20: ireturn

  private static final java.lang.String invoke$lambda$7$lambda$4(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #157                // String str
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: iconst_0
       8: aload_0
       9: invokevirtual #178                // Method java/lang/String.length:()I
      12: iconst_1
      13: isub
      14: invokevirtual #181                // Method java/lang/String.substring:(II)Ljava/lang/String;
      17: dup
      18: ldc           #163                // String substring(...)
      20: invokestatic  #166                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      23: areturn

  private static final char invoke$lambda$7$lambda$5(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #168                // String $this$findDigit
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #23                 // class java/lang/CharSequence
      10: invokestatic  #184                // Method kotlin/text/StringsKt.last:(Ljava/lang/CharSequence;)C
      13: ireturn

  private static final boolean invoke$lambda$7$lambda$6(java.lang.String, java.lang.String);
    Code:
       0: aload_0
       1: ldc           #168                // String $this$findDigit
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #173                // String it
       9: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: aload_1
      14: iconst_0
      15: iconst_2
      16: aconst_null
      17: invokestatic  #187                // Method kotlin/text/StringsKt.endsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
      20: ireturn
}

Compiled from "Day01.kt"
public final class net.rafaeltoledo.kotlin.advent.Day01Kt {
  private static final java.util.Map<java.lang.String, java.lang.Integer> numbers;

  private static final java.lang.String findDigit(java.lang.String, kotlin.jvm.functions.Function1<? super java.lang.String, java.lang.String>, kotlin.jvm.functions.Function1<? super java.lang.String, java.lang.Character>, kotlin.jvm.functions.Function2<? super java.lang.String, ? super java.lang.String, java.lang.Boolean>);
    Code:
       0: aload_0
       1: astore        4
       3: aload         4
       5: checkcast     #9                  // class java/lang/CharSequence
       8: invokeinterface #13,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      13: ifne          20
      16: iconst_1
      17: goto          21
      20: iconst_0
      21: ifne          74
      24: aload         4
      26: aload_2
      27: invokedynamic #33,  0             // InvokeDynamic #0:invoke:(Lkotlin/jvm/functions/Function1;)Lkotlin/jvm/functions/Function1;
      32: aload_3
      33: invokedynamic #45,  0             // InvokeDynamic #1:invoke:(Lkotlin/jvm/functions/Function2;)Lkotlin/jvm/functions/Function2;
      38: invokestatic  #48                 // Method findDigit:(Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;)I
      41: istore        5
      43: iload         5
      45: iconst_m1
      46: if_icmpne     65
      49: aload_1
      50: aload         4
      52: invokeinterface #52,  2           // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
      57: checkcast     #54                 // class java/lang/String
      60: astore        4
      62: goto          71
      65: iload         5
      67: invokestatic  #58                 // Method java/lang/String.valueOf:(I)Ljava/lang/String;
      70: areturn
      71: goto          3
      74: ldc           #60                 // String
      76: areturn

  private static final int findDigit(java.lang.String, kotlin.jvm.functions.Function1<? super java.lang.String, java.lang.Character>, kotlin.jvm.functions.Function2<? super java.lang.String, ? super java.lang.String, java.lang.Boolean>);
    Code:
       0: aload_0
       1: checkcast     #9                  // class java/lang/CharSequence
       4: invokeinterface #13,  1           // InterfaceMethod java/lang/CharSequence.length:()I
       9: ifne          16
      12: iconst_1
      13: goto          17
      16: iconst_0
      17: ifeq          22
      20: iconst_m1
      21: ireturn
      22: aload_1
      23: aload_0
      24: invokeinterface #52,  2           // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
      29: checkcast     #73                 // class java/lang/Character
      32: invokevirtual #77                 // Method java/lang/Character.charValue:()C
      35: invokestatic  #81                 // Method java/lang/Character.isDigit:(C)Z
      38: ifeq          58
      41: aload_1
      42: aload_0
      43: invokeinterface #52,  2           // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
      48: checkcast     #73                 // class java/lang/Character
      51: invokevirtual #77                 // Method java/lang/Character.charValue:()C
      54: invokestatic  #87                 // Method kotlin/text/CharsKt.digitToInt:(C)I
      57: ireturn
      58: getstatic     #91                 // Field numbers:Ljava/util/Map;
      61: invokeinterface #97,  1           // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
      66: checkcast     #99                 // class java/lang/Iterable
      69: astore_3
      70: iconst_0
      71: istore        4
      73: aload_3
      74: invokeinterface #103,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      79: astore        5
      81: aload         5
      83: invokeinterface #109,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      88: ifeq          154
      91: aload         5
      93: invokeinterface #113,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      98: astore        6
     100: aload         6
     102: checkcast     #54                 // class java/lang/String
     105: astore        7
     107: iconst_0
     108: istore        8
     110: aload_2
     111: aload_0
     112: aload         7
     114: invokeinterface #117,  3          // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     119: checkcast     #119                // class java/lang/Boolean
     122: invokevirtual #122                // Method java/lang/Boolean.booleanValue:()Z
     125: ifeq          149
     128: getstatic     #91                 // Field numbers:Ljava/util/Map;
     131: aload         7
     133: iconst_m1
     134: invokestatic  #127                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     137: invokeinterface #130,  3          // InterfaceMethod java/util/Map.getOrDefault:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     142: checkcast     #132                // class java/lang/Number
     145: invokevirtual #135                // Method java/lang/Number.intValue:()I
     148: ireturn
     149: nop
     150: nop
     151: goto          81
     154: nop
     155: iconst_m1
     156: ireturn

  private static final char findDigit$lambda$0(kotlin.jvm.functions.Function1, java.lang.String);
    Code:
       0: aload_1
       1: ldc           #143                // String $this$findDigit
       3: invokestatic  #149                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: invokeinterface #52,  2           // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
      13: checkcast     #73                 // class java/lang/Character
      16: invokevirtual #77                 // Method java/lang/Character.charValue:()C
      19: ireturn

  private static final boolean findDigit$lambda$1(kotlin.jvm.functions.Function2, java.lang.String, java.lang.String);
    Code:
       0: aload_1
       1: ldc           #143                // String $this$findDigit
       3: invokestatic  #149                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #151                // String it
       9: invokestatic  #149                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: aload_1
      14: aload_2
      15: invokeinterface #117,  3          // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      20: checkcast     #119                // class java/lang/Boolean
      23: invokevirtual #122                // Method java/lang/Boolean.booleanValue:()Z
      26: ireturn

  public static final java.lang.String access$findDigit(java.lang.String, kotlin.jvm.functions.Function1, kotlin.jvm.functions.Function1, kotlin.jvm.functions.Function2);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: aload_3
       4: invokestatic  #155                // Method findDigit:(Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;)Ljava/lang/String;
       7: areturn

  static {};
    Code:
       0: bipush        9
       2: anewarray     #160                // class kotlin/Pair
       5: astore_0
       6: aload_0
       7: iconst_0
       8: ldc           #162                // String one
      10: iconst_1
      11: invokestatic  #127                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      14: invokestatic  #168                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      17: aastore
      18: aload_0
      19: iconst_1
      20: ldc           #170                // String two
      22: iconst_2
      23: invokestatic  #127                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      26: invokestatic  #168                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      29: aastore
      30: aload_0
      31: iconst_2
      32: ldc           #172                // String three
      34: iconst_3
      35: invokestatic  #127                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      38: invokestatic  #168                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      41: aastore
      42: aload_0
      43: iconst_3
      44: ldc           #174                // String four
      46: iconst_4
      47: invokestatic  #127                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      50: invokestatic  #168                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      53: aastore
      54: aload_0
      55: iconst_4
      56: ldc           #176                // String five
      58: iconst_5
      59: invokestatic  #127                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      62: invokestatic  #168                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      65: aastore
      66: aload_0
      67: iconst_5
      68: ldc           #178                // String six
      70: bipush        6
      72: invokestatic  #127                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      75: invokestatic  #168                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      78: aastore
      79: aload_0
      80: bipush        6
      82: ldc           #180                // String seven
      84: bipush        7
      86: invokestatic  #127                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      89: invokestatic  #168                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      92: aastore
      93: aload_0
      94: bipush        7
      96: ldc           #182                // String eight
      98: bipush        8
     100: invokestatic  #127                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     103: invokestatic  #168                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     106: aastore
     107: aload_0
     108: bipush        8
     110: ldc           #184                // String nine
     112: bipush        9
     114: invokestatic  #127                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     117: invokestatic  #168                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     120: aastore
     121: aload_0
     122: invokestatic  #190                // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;
     125: putstatic     #91                 // Field numbers:Ljava/util/Map;
     128: return
}