import java.io.File

fun main() {

    val lowerCase = ('a'..'z').toList()
    val upperCase = ('A'..'Z').toList()

    fun part1(input: String) {
        var result = 0
        input.split("\r").map { it.trim() }.forEach {
            val firstCompartment = it.substring(0, it.length / 2)
            val secondCompartment = it.substring(it.length / 2, it.length)
            var sameCharacter = ' '
            secondCompartment.forEach { c -> if (firstCompartment.contains(c)) sameCharacter = c }
            if (lowerCase.contains(sameCharacter)) result += (lowerCase.indexOf(sameCharacter) + 1)
            if (upperCase.contains(sameCharacter)) result += (upperCase.indexOf(sameCharacter) + 27)
        }
        println(result)
    }

    fun part2(input: String) {
        var result = 0
        input.split("\r").map { it.trim() }.chunked(3).forEach { list ->
            var sameCharacter = ' '
            list.first().forEach { c ->
                var lastContains = true
                list.forEach {
                    if (lastContains && !it.contains(c)) lastContains = false
                }
                if (lastContains) sameCharacter = c
            }
            if (lowerCase.contains(sameCharacter)) result += (lowerCase.indexOf(sameCharacter) + 1)
            if (upperCase.contains(sameCharacter)) result += (upperCase.indexOf(sameCharacter) + 27)
        }
        println(result)

    }

    val input = File("src/Day03.txt").readText()
    part1(input)
    part2(input)
}

Compiled from "Day03.kt"
public final class Day03Kt {
  public static final void main();
    Code:
       0: new           #8                  // class kotlin/ranges/CharRange
       3: dup
       4: bipush        97
       6: bipush        122
       8: invokespecial #12                 // Method kotlin/ranges/CharRange."<init>":(CC)V
      11: checkcast     #14                 // class java/lang/Iterable
      14: invokestatic  #20                 // Method kotlin/collections/CollectionsKt.toList:(Ljava/lang/Iterable;)Ljava/util/List;
      17: astore_0
      18: new           #8                  // class kotlin/ranges/CharRange
      21: dup
      22: bipush        65
      24: bipush        90
      26: invokespecial #12                 // Method kotlin/ranges/CharRange."<init>":(CC)V
      29: checkcast     #14                 // class java/lang/Iterable
      32: invokestatic  #20                 // Method kotlin/collections/CollectionsKt.toList:(Ljava/lang/Iterable;)Ljava/util/List;
      35: astore_1
      36: new           #22                 // class java/io/File
      39: dup
      40: ldc           #24                 // String src/Day03.txt
      42: invokespecial #27                 // Method java/io/File."<init>":(Ljava/lang/String;)V
      45: aconst_null
      46: iconst_1
      47: aconst_null
      48: invokestatic  #33                 // Method kotlin/io/FilesKt.readText$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/lang/String;
      51: astore_2
      52: aload_0
      53: aload_1
      54: aload_2
      55: invokestatic  #37                 // Method main$part1:(Ljava/util/List;Ljava/util/List;Ljava/lang/String;)V
      58: aload_0
      59: aload_1
      60: aload_2
      61: invokestatic  #40                 // Method main$part2:(Ljava/util/List;Ljava/util/List;Ljava/lang/String;)V
      64: return

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

  private static final void main$part1(java.util.List<java.lang.Character>, java.util.List<java.lang.Character>, java.lang.String);
    Code:
       0: iconst_0
       1: istore_3
       2: aload_2
       3: checkcast     #53                 // class java/lang/CharSequence
       6: iconst_1
       7: anewarray     #55                 // class java/lang/String
      10: astore        4
      12: aload         4
      14: iconst_0
      15: ldc           #57                 // String \r
      17: aastore
      18: aload         4
      20: iconst_0
      21: iconst_0
      22: bipush        6
      24: aconst_null
      25: invokestatic  #63                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      28: checkcast     #14                 // class java/lang/Iterable
      31: astore        4
      33: iconst_0
      34: istore        5
      36: aload         4
      38: astore        6
      40: new           #65                 // class java/util/ArrayList
      43: dup
      44: aload         4
      46: bipush        10
      48: invokestatic  #69                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      51: invokespecial #72                 // Method java/util/ArrayList."<init>":(I)V
      54: checkcast     #74                 // class java/util/Collection
      57: astore        7
      59: iconst_0
      60: istore        8
      62: aload         6
      64: invokeinterface #78,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      69: astore        9
      71: aload         9
      73: invokeinterface #84,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      78: ifeq          128
      81: aload         9
      83: invokeinterface #88,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      88: astore        10
      90: aload         7
      92: aload         10
      94: checkcast     #55                 // class java/lang/String
      97: astore        11
      99: astore        19
     101: iconst_0
     102: istore        12
     104: aload         11
     106: checkcast     #53                 // class java/lang/CharSequence
     109: invokestatic  #92                 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     112: invokevirtual #96                 // Method java/lang/Object.toString:()Ljava/lang/String;
     115: nop
     116: aload         19
     118: swap
     119: invokeinterface #100,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     124: pop
     125: goto          71
     128: aload         7
     130: checkcast     #102                // class java/util/List
     133: nop
     134: checkcast     #14                 // class java/lang/Iterable
     137: astore        4
     139: nop
     140: iconst_0
     141: istore        5
     143: aload         4
     145: invokeinterface #78,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     150: astore        6
     152: aload         6
     154: invokeinterface #84,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     159: ifeq          371
     162: aload         6
     164: invokeinterface #88,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     169: astore        7
     171: aload         7
     173: checkcast     #55                 // class java/lang/String
     176: astore        8
     178: iconst_0
     179: istore        9
     181: aload         8
     183: iconst_0
     184: aload         8
     186: invokevirtual #106                // Method java/lang/String.length:()I
     189: iconst_2
     190: idiv
     191: invokevirtual #110                // Method java/lang/String.substring:(II)Ljava/lang/String;
     194: dup
     195: ldc           #112                // String substring(...)
     197: invokestatic  #118                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     200: astore        10
     202: aload         8
     204: aload         8
     206: invokevirtual #106                // Method java/lang/String.length:()I
     209: iconst_2
     210: idiv
     211: aload         8
     213: invokevirtual #106                // Method java/lang/String.length:()I
     216: invokevirtual #110                // Method java/lang/String.substring:(II)Ljava/lang/String;
     219: dup
     220: ldc           #112                // String substring(...)
     222: invokestatic  #118                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     225: astore        11
     227: iconst_0
     228: istore        12
     230: bipush        32
     232: istore        12
     234: aload         11
     236: checkcast     #53                 // class java/lang/CharSequence
     239: astore        13
     241: iconst_0
     242: istore        14
     244: iconst_0
     245: istore        15
     247: iload         15
     249: aload         13
     251: invokeinterface #119,  1          // InterfaceMethod java/lang/CharSequence.length:()I
     256: if_icmpge     304
     259: aload         13
     261: iload         15
     263: invokeinterface #123,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     268: istore        16
     270: iload         16
     272: istore        17
     274: iconst_0
     275: istore        18
     277: aload         10
     279: checkcast     #53                 // class java/lang/CharSequence
     282: iload         17
     284: iconst_0
     285: iconst_2
     286: aconst_null
     287: invokestatic  #127                // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;CZILjava/lang/Object;)Z
     290: ifeq          297
     293: iload         17
     295: istore        12
     297: nop
     298: iinc          15, 1
     301: goto          247
     304: nop
     305: aload_0
     306: iload         12
     308: invokestatic  #133                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     311: invokeinterface #136,  2          // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
     316: ifeq          335
     319: iload_3
     320: aload_0
     321: iload         12
     323: invokestatic  #133                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     326: invokeinterface #140,  2          // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I
     331: iconst_1
     332: iadd
     333: iadd
     334: istore_3
     335: aload_1
     336: iload         12
     338: invokestatic  #133                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     341: invokeinterface #136,  2          // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
     346: ifeq          366
     349: iload_3
     350: aload_1
     351: iload         12
     353: invokestatic  #133                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     356: invokeinterface #140,  2          // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I
     361: bipush        27
     363: iadd
     364: iadd
     365: istore_3
     366: nop
     367: nop
     368: goto          152
     371: nop
     372: iload_3
     373: istore        4
     375: getstatic     #146                // Field java/lang/System.out:Ljava/io/PrintStream;
     378: iload         4
     380: invokevirtual #151                // Method java/io/PrintStream.println:(I)V
     383: return

  private static final void main$part2(java.util.List<java.lang.Character>, java.util.List<java.lang.Character>, java.lang.String);
    Code:
       0: iconst_0
       1: istore_3
       2: aload_2
       3: checkcast     #53                 // class java/lang/CharSequence
       6: iconst_1
       7: anewarray     #55                 // class java/lang/String
      10: astore        4
      12: aload         4
      14: iconst_0
      15: ldc           #57                 // String \r
      17: aastore
      18: aload         4
      20: iconst_0
      21: iconst_0
      22: bipush        6
      24: aconst_null
      25: invokestatic  #63                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      28: checkcast     #14                 // class java/lang/Iterable
      31: astore        4
      33: iconst_0
      34: istore        5
      36: aload         4
      38: astore        6
      40: new           #65                 // class java/util/ArrayList
      43: dup
      44: aload         4
      46: bipush        10
      48: invokestatic  #69                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      51: invokespecial #72                 // Method java/util/ArrayList."<init>":(I)V
      54: checkcast     #74                 // class java/util/Collection
      57: astore        7
      59: iconst_0
      60: istore        8
      62: aload         6
      64: invokeinterface #78,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      69: astore        9
      71: aload         9
      73: invokeinterface #84,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      78: ifeq          128
      81: aload         9
      83: invokeinterface #88,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      88: astore        10
      90: aload         7
      92: aload         10
      94: checkcast     #55                 // class java/lang/String
      97: astore        11
      99: astore        24
     101: iconst_0
     102: istore        12
     104: aload         11
     106: checkcast     #53                 // class java/lang/CharSequence
     109: invokestatic  #92                 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     112: invokevirtual #96                 // Method java/lang/Object.toString:()Ljava/lang/String;
     115: nop
     116: aload         24
     118: swap
     119: invokeinterface #100,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     124: pop
     125: goto          71
     128: aload         7
     130: checkcast     #102                // class java/util/List
     133: nop
     134: checkcast     #14                 // class java/lang/Iterable
     137: iconst_3
     138: invokestatic  #179                // Method kotlin/collections/CollectionsKt.chunked:(Ljava/lang/Iterable;I)Ljava/util/List;
     141: checkcast     #14                 // class java/lang/Iterable
     144: astore        4
     146: iconst_0
     147: istore        5
     149: aload         4
     151: invokeinterface #78,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     156: astore        6
     158: aload         6
     160: invokeinterface #84,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     165: ifeq          408
     168: aload         6
     170: invokeinterface #88,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     175: astore        7
     177: aload         7
     179: checkcast     #102                // class java/util/List
     182: astore        8
     184: iconst_0
     185: istore        9
     187: iconst_0
     188: istore        10
     190: bipush        32
     192: istore        10
     194: aload         8
     196: invokestatic  #183                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
     199: checkcast     #53                 // class java/lang/CharSequence
     202: astore        11
     204: iconst_0
     205: istore        12
     207: iconst_0
     208: istore        13
     210: iload         13
     212: aload         11
     214: invokeinterface #119,  1          // InterfaceMethod java/lang/CharSequence.length:()I
     219: if_icmpge     341
     222: aload         11
     224: iload         13
     226: invokeinterface #123,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     231: istore        14
     233: iload         14
     235: istore        15
     237: iconst_0
     238: istore        16
     240: iconst_0
     241: istore        17
     243: iconst_1
     244: istore        17
     246: aload         8
     248: checkcast     #14                 // class java/lang/Iterable
     251: astore        18
     253: iconst_0
     254: istore        19
     256: aload         18
     258: invokeinterface #78,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     263: astore        20
     265: aload         20
     267: invokeinterface #84,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     272: ifeq          323
     275: aload         20
     277: invokeinterface #88,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     282: astore        21
     284: aload         21
     286: checkcast     #55                 // class java/lang/String
     289: astore        22
     291: iconst_0
     292: istore        23
     294: iload         17
     296: ifeq          318
     299: aload         22
     301: checkcast     #53                 // class java/lang/CharSequence
     304: iload         15
     306: iconst_0
     307: iconst_2
     308: aconst_null
     309: invokestatic  #127                // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;CZILjava/lang/Object;)Z
     312: ifne          318
     315: iconst_0
     316: istore        17
     318: nop
     319: nop
     320: goto          265
     323: nop
     324: iload         17
     326: ifeq          333
     329: iload         15
     331: istore        10
     333: nop
     334: nop
     335: iinc          13, 1
     338: goto          210
     341: nop
     342: aload_0
     343: iload         10
     345: invokestatic  #133                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     348: invokeinterface #136,  2          // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
     353: ifeq          372
     356: iload_3
     357: aload_0
     358: iload         10
     360: invokestatic  #133                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     363: invokeinterface #140,  2          // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I
     368: iconst_1
     369: iadd
     370: iadd
     371: istore_3
     372: aload_1
     373: iload         10
     375: invokestatic  #133                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     378: invokeinterface #136,  2          // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
     383: ifeq          403
     386: iload_3
     387: aload_1
     388: iload         10
     390: invokestatic  #133                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     393: invokeinterface #140,  2          // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I
     398: bipush        27
     400: iadd
     401: iadd
     402: istore_3
     403: nop
     404: nop
     405: goto          158
     408: nop
     409: iload_3
     410: istore        4
     412: getstatic     #146                // Field java/lang/System.out:Ljava/io/PrintStream;
     415: iload         4
     417: invokevirtual #151                // Method java/io/PrintStream.println:(I)V
     420: return
}


import java.io.File

val meL = "XYZ".toList()
val opponentL = "ABC".toList()
fun main() {
    fun part1(input: String) {
        val rounds = input.split("\r")
        var result = 0
        rounds.forEach {
            val me = it.split(" ").last()
            val opponent = it.split(" ").first()
            val p = getPoints(
                Pair(
                    meL.indexOf(me.trim().toCharArray().first()),
                    opponentL.indexOf(opponent.trim().toCharArray().first())
                )
            )
            result += p
        }
        println(result)
    }

    fun part2(input: String) {
        val rounds = input.split("\r")
        var result = 0
        rounds.forEach {
            val type = it.split(" ").last()
            val opponent = it.split(" ").first()
            var character = ""
            when (type) {
                "X" -> character = opponent.trim().characterToLose
                "Y" -> character = opponent.trim().characterToDraw
                "Z" -> character = opponent.trim().characterToWin
            }
            val p = getPoints(
                Pair(
                    meL.indexOf(character.trim().toCharArray().first()),
                    opponentL.indexOf(opponent.trim().toCharArray().first())
                )
            )
            result += p
        }
        println(result)

    }

    val input = File("src/Day02.txt").readText()
    part2(input)

}

val String.characterToWin: String
    get() {
        if (this == "A") return "Y"
        if (this == "B") return "Z"
        if (this == "C") return "X"
        return TODO("Provide the return value")
    }

val String.characterToDraw: String
    get() {
        return meL[opponentL.indexOf(this.trim().toCharArray().first())].toString()
    }

val String.characterToLose: String
    get() {
        if (this == "A") return "Z"
        if (this == "B") return "X"
        if (this == "C") return "Y"
        return TODO("Provide the return value")
    }

fun getPoints(pair: Pair<Int, Int>): Int {
    val me = pair.first
    val opponent = pair.second
    var points = 0
    if (me == opponent) points += 3
    if (me == 0 && (opponent == 2)) points += 6
    if (me == 1 && (opponent == 0)) points += 6
    if (me == 2 && (opponent == 1)) points += 6

    if (me == 0) points += 1
    if (me == 1) points += 2
    if (me == 2) points += 3

    return points
}

Compiled from "Day02.kt"
public final class Day02Kt {
  private static final java.util.List<java.lang.Character> meL;

  private static final java.util.List<java.lang.Character> opponentL;

  public static final java.util.List<java.lang.Character> getMeL();
    Code:
       0: getstatic     #12                 // Field meL:Ljava/util/List;
       3: areturn

  public static final java.util.List<java.lang.Character> getOpponentL();
    Code:
       0: getstatic     #16                 // Field opponentL:Ljava/util/List;
       3: areturn

  public static final void main();
    Code:
       0: new           #20                 // class java/io/File
       3: dup
       4: ldc           #22                 // String src/Day02.txt
       6: invokespecial #26                 // Method java/io/File."<init>":(Ljava/lang/String;)V
       9: aconst_null
      10: iconst_1
      11: aconst_null
      12: invokestatic  #32                 // Method kotlin/io/FilesKt.readText$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/lang/String;
      15: astore_0
      16: aload_0
      17: invokestatic  #35                 // Method main$part2:(Ljava/lang/String;)V
      20: return

  public static final java.lang.String getCharacterToWin(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #41                 // String <this>
       3: invokestatic  #47                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: ldc           #49                 // String A
       9: invokestatic  #53                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      12: ifeq          18
      15: ldc           #55                 // String Y
      17: areturn
      18: aload_0
      19: ldc           #57                 // String B
      21: invokestatic  #53                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      24: ifeq          30
      27: ldc           #59                 // String Z
      29: areturn
      30: aload_0
      31: ldc           #61                 // String C
      33: invokestatic  #53                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      36: ifeq          42
      39: ldc           #63                 // String X
      41: areturn
      42: ldc           #65                 // String Provide the return value
      44: astore_1
      45: new           #67                 // class kotlin/NotImplementedError
      48: dup
      49: new           #69                 // class java/lang/StringBuilder
      52: dup
      53: invokespecial #71                 // Method java/lang/StringBuilder."<init>":()V
      56: ldc           #73                 // String An operation is not implemented:
      58: invokevirtual #77                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      61: aload_1
      62: invokevirtual #77                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      65: invokevirtual #81                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      68: invokespecial #82                 // Method kotlin/NotImplementedError."<init>":(Ljava/lang/String;)V
      71: athrow

  public static final java.lang.String getCharacterToDraw(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #41                 // String <this>
       3: invokestatic  #47                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: getstatic     #12                 // Field meL:Ljava/util/List;
       9: getstatic     #16                 // Field opponentL:Ljava/util/List;
      12: aload_0
      13: checkcast     #86                 // class java/lang/CharSequence
      16: invokestatic  #92                 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
      19: invokevirtual #93                 // Method java/lang/Object.toString:()Ljava/lang/String;
      22: invokevirtual #99                 // Method java/lang/String.toCharArray:()[C
      25: dup
      26: ldc           #101                // String toCharArray(...)
      28: invokestatic  #104                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      31: invokestatic  #110                // Method kotlin/collections/ArraysKt.first:([C)C
      34: invokestatic  #116                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      37: invokeinterface #122,  2          // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I
      42: invokeinterface #126,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      47: checkcast     #112                // class java/lang/Character
      50: invokevirtual #130                // Method java/lang/Character.charValue:()C
      53: invokestatic  #133                // Method java/lang/String.valueOf:(C)Ljava/lang/String;
      56: areturn

  public static final java.lang.String getCharacterToLose(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #41                 // String <this>
       3: invokestatic  #47                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: ldc           #49                 // String A
       9: invokestatic  #53                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      12: ifeq          18
      15: ldc           #59                 // String Z
      17: areturn
      18: aload_0
      19: ldc           #57                 // String B
      21: invokestatic  #53                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      24: ifeq          30
      27: ldc           #63                 // String X
      29: areturn
      30: aload_0
      31: ldc           #61                 // String C
      33: invokestatic  #53                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      36: ifeq          42
      39: ldc           #55                 // String Y
      41: areturn
      42: ldc           #65                 // String Provide the return value
      44: astore_1
      45: new           #67                 // class kotlin/NotImplementedError
      48: dup
      49: new           #69                 // class java/lang/StringBuilder
      52: dup
      53: invokespecial #71                 // Method java/lang/StringBuilder."<init>":()V
      56: ldc           #73                 // String An operation is not implemented:
      58: invokevirtual #77                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      61: aload_1
      62: invokevirtual #77                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      65: invokevirtual #81                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      68: invokespecial #82                 // Method kotlin/NotImplementedError."<init>":(Ljava/lang/String;)V
      71: athrow

  public static final int getPoints(kotlin.Pair<java.lang.Integer, java.lang.Integer>);
    Code:
       0: aload_0
       1: ldc           #141                // String pair
       3: invokestatic  #47                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokevirtual #147                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      10: checkcast     #149                // class java/lang/Number
      13: invokevirtual #153                // Method java/lang/Number.intValue:()I
      16: istore_1
      17: aload_0
      18: invokevirtual #156                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      21: checkcast     #149                // class java/lang/Number
      24: invokevirtual #153                // Method java/lang/Number.intValue:()I
      27: istore_2
      28: iconst_0
      29: istore_3
      30: iload_1
      31: iload_2
      32: if_icmpne     38
      35: iinc          3, 3
      38: iload_1
      39: ifne          50
      42: iload_2
      43: iconst_2
      44: if_icmpne     50
      47: iinc          3, 6
      50: iload_1
      51: iconst_1
      52: if_icmpne     62
      55: iload_2
      56: ifne          62
      59: iinc          3, 6
      62: iload_1
      63: iconst_2
      64: if_icmpne     75
      67: iload_2
      68: iconst_1
      69: if_icmpne     75
      72: iinc          3, 6
      75: iload_1
      76: ifne          82
      79: iinc          3, 1
      82: iload_1
      83: iconst_1
      84: if_icmpne     90
      87: iinc          3, 2
      90: iload_1
      91: iconst_2
      92: if_icmpne     98
      95: iinc          3, 3
      98: iload_3
      99: ireturn

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

  private static final void main$part1(java.lang.String);
    Code:
       0: aload_0
       1: checkcast     #86                 // class java/lang/CharSequence
       4: iconst_1
       5: anewarray     #95                 // class java/lang/String
       8: astore_2
       9: aload_2
      10: iconst_0
      11: ldc           #169                // String \r
      13: aastore
      14: aload_2
      15: iconst_0
      16: iconst_0
      17: bipush        6
      19: aconst_null
      20: invokestatic  #173                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      23: astore_1
      24: iconst_0
      25: istore_2
      26: aload_1
      27: checkcast     #175                // class java/lang/Iterable
      30: astore_3
      31: iconst_0
      32: istore        4
      34: aload_3
      35: invokeinterface #179,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      40: astore        5
      42: aload         5
      44: invokeinterface #185,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      49: ifeq          237
      52: aload         5
      54: invokeinterface #188,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      59: astore        6
      61: aload         6
      63: checkcast     #95                 // class java/lang/String
      66: astore        7
      68: iconst_0
      69: istore        8
      71: aload         7
      73: checkcast     #86                 // class java/lang/CharSequence
      76: iconst_1
      77: anewarray     #95                 // class java/lang/String
      80: astore        9
      82: aload         9
      84: iconst_0
      85: ldc           #190                // String
      87: aastore
      88: aload         9
      90: iconst_0
      91: iconst_0
      92: bipush        6
      94: aconst_null
      95: invokestatic  #173                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      98: invokestatic  #196                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     101: checkcast     #95                 // class java/lang/String
     104: astore        10
     106: aload         7
     108: checkcast     #86                 // class java/lang/CharSequence
     111: iconst_1
     112: anewarray     #95                 // class java/lang/String
     115: astore        11
     117: aload         11
     119: iconst_0
     120: ldc           #190                // String
     122: aastore
     123: aload         11
     125: iconst_0
     126: iconst_0
     127: bipush        6
     129: aconst_null
     130: invokestatic  #173                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     133: invokestatic  #198                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
     136: checkcast     #95                 // class java/lang/String
     139: astore        9
     141: new           #143                // class kotlin/Pair
     144: dup
     145: getstatic     #12                 // Field meL:Ljava/util/List;
     148: aload         10
     150: checkcast     #86                 // class java/lang/CharSequence
     153: invokestatic  #92                 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     156: invokevirtual #93                 // Method java/lang/Object.toString:()Ljava/lang/String;
     159: invokevirtual #99                 // Method java/lang/String.toCharArray:()[C
     162: dup
     163: ldc           #101                // String toCharArray(...)
     165: invokestatic  #104                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     168: invokestatic  #110                // Method kotlin/collections/ArraysKt.first:([C)C
     171: invokestatic  #116                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     174: invokeinterface #122,  2          // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I
     179: invokestatic  #203                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     182: getstatic     #16                 // Field opponentL:Ljava/util/List;
     185: aload         9
     187: checkcast     #86                 // class java/lang/CharSequence
     190: invokestatic  #92                 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     193: invokevirtual #93                 // Method java/lang/Object.toString:()Ljava/lang/String;
     196: invokevirtual #99                 // Method java/lang/String.toCharArray:()[C
     199: dup
     200: ldc           #101                // String toCharArray(...)
     202: invokestatic  #104                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     205: invokestatic  #110                // Method kotlin/collections/ArraysKt.first:([C)C
     208: invokestatic  #116                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     211: invokeinterface #122,  2          // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I
     216: invokestatic  #203                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     219: invokespecial #206                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     222: invokestatic  #208                // Method getPoints:(Lkotlin/Pair;)I
     225: istore        11
     227: iload_2
     228: iload         11
     230: iadd
     231: istore_2
     232: nop
     233: nop
     234: goto          42
     237: nop
     238: iload_2
     239: istore_3
     240: getstatic     #214                // Field java/lang/System.out:Ljava/io/PrintStream;
     243: iload_3
     244: invokevirtual #220                // Method java/io/PrintStream.println:(I)V
     247: return

  private static final void main$part2(java.lang.String);
    Code:
       0: aload_0
       1: checkcast     #86                 // class java/lang/CharSequence
       4: iconst_1
       5: anewarray     #95                 // class java/lang/String
       8: astore_2
       9: aload_2
      10: iconst_0
      11: ldc           #169                // String \r
      13: aastore
      14: aload_2
      15: iconst_0
      16: iconst_0
      17: bipush        6
      19: aconst_null
      20: invokestatic  #173                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      23: astore_1
      24: iconst_0
      25: istore_2
      26: aload_1
      27: checkcast     #175                // class java/lang/Iterable
      30: astore_3
      31: iconst_0
      32: istore        4
      34: aload_3
      35: invokeinterface #179,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      40: astore        5
      42: aload         5
      44: invokeinterface #185,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      49: ifeq          369
      52: aload         5
      54: invokeinterface #188,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      59: astore        6
      61: aload         6
      63: checkcast     #95                 // class java/lang/String
      66: astore        7
      68: iconst_0
      69: istore        8
      71: aload         7
      73: checkcast     #86                 // class java/lang/CharSequence
      76: iconst_1
      77: anewarray     #95                 // class java/lang/String
      80: astore        9
      82: aload         9
      84: iconst_0
      85: ldc           #190                // String
      87: aastore
      88: aload         9
      90: iconst_0
      91: iconst_0
      92: bipush        6
      94: aconst_null
      95: invokestatic  #173                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      98: invokestatic  #196                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     101: checkcast     #95                 // class java/lang/String
     104: astore        10
     106: aload         7
     108: checkcast     #86                 // class java/lang/CharSequence
     111: iconst_1
     112: anewarray     #95                 // class java/lang/String
     115: astore        11
     117: aload         11
     119: iconst_0
     120: ldc           #190                // String
     122: aastore
     123: aload         11
     125: iconst_0
     126: iconst_0
     127: bipush        6
     129: aconst_null
     130: invokestatic  #173                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     133: invokestatic  #198                // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
     136: checkcast     #95                 // class java/lang/String
     139: astore        9
     141: ldc           #232                // String
     143: astore        11
     145: aload         10
     147: astore        12
     149: aload         12
     151: invokevirtual #235                // Method java/lang/String.hashCode:()I
     154: tableswitch   { // 88 to 90
                    88: 180
                    89: 193
                    90: 206
               default: 273
          }
     180: aload         12
     182: ldc           #63                 // String X
     184: invokevirtual #239                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     187: ifne          219
     190: goto          273
     193: aload         12
     195: ldc           #55                 // String Y
     197: invokevirtual #239                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     200: ifne          238
     203: goto          273
     206: aload         12
     208: ldc           #59                 // String Z
     210: invokevirtual #239                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     213: ifne          257
     216: goto          273
     219: aload         9
     221: checkcast     #86                 // class java/lang/CharSequence
     224: invokestatic  #92                 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     227: invokevirtual #93                 // Method java/lang/Object.toString:()Ljava/lang/String;
     230: invokestatic  #241                // Method getCharacterToLose:(Ljava/lang/String;)Ljava/lang/String;
     233: astore        11
     235: goto          273
     238: aload         9
     240: checkcast     #86                 // class java/lang/CharSequence
     243: invokestatic  #92                 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     246: invokevirtual #93                 // Method java/lang/Object.toString:()Ljava/lang/String;
     249: invokestatic  #243                // Method getCharacterToDraw:(Ljava/lang/String;)Ljava/lang/String;
     252: astore        11
     254: goto          273
     257: aload         9
     259: checkcast     #86                 // class java/lang/CharSequence
     262: invokestatic  #92                 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     265: invokevirtual #93                 // Method java/lang/Object.toString:()Ljava/lang/String;
     268: invokestatic  #245                // Method getCharacterToWin:(Ljava/lang/String;)Ljava/lang/String;
     271: astore        11
     273: new           #143                // class kotlin/Pair
     276: dup
     277: getstatic     #12                 // Field meL:Ljava/util/List;
     280: aload         11
     282: checkcast     #86                 // class java/lang/CharSequence
     285: invokestatic  #92                 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     288: invokevirtual #93                 // Method java/lang/Object.toString:()Ljava/lang/String;
     291: invokevirtual #99                 // Method java/lang/String.toCharArray:()[C
     294: dup
     295: ldc           #101                // String toCharArray(...)
     297: invokestatic  #104                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     300: invokestatic  #110                // Method kotlin/collections/ArraysKt.first:([C)C
     303: invokestatic  #116                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     306: invokeinterface #122,  2          // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I
     311: invokestatic  #203                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     314: getstatic     #16                 // Field opponentL:Ljava/util/List;
     317: aload         9
     319: checkcast     #86                 // class java/lang/CharSequence
     322: invokestatic  #92                 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     325: invokevirtual #93                 // Method java/lang/Object.toString:()Ljava/lang/String;
     328: invokevirtual #99                 // Method java/lang/String.toCharArray:()[C
     331: dup
     332: ldc           #101                // String toCharArray(...)
     334: invokestatic  #104                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     337: invokestatic  #110                // Method kotlin/collections/ArraysKt.first:([C)C
     340: invokestatic  #116                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     343: invokeinterface #122,  2          // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I
     348: invokestatic  #203                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     351: invokespecial #206                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     354: invokestatic  #208                // Method getPoints:(Lkotlin/Pair;)I
     357: istore        12
     359: iload_2
     360: iload         12
     362: iadd
     363: istore_2
     364: nop
     365: nop
     366: goto          42
     369: nop
     370: iload_2
     371: istore_3
     372: getstatic     #214                // Field java/lang/System.out:Ljava/io/PrintStream;
     375: iload_3
     376: invokevirtual #220                // Method java/io/PrintStream.println:(I)V
     379: return

  static {};
    Code:
       0: ldc           #251                // String XYZ
       2: checkcast     #86                 // class java/lang/CharSequence
       5: invokestatic  #255                // Method kotlin/text/StringsKt.toList:(Ljava/lang/CharSequence;)Ljava/util/List;
       8: putstatic     #12                 // Field meL:Ljava/util/List;
      11: ldc_w         #257                // String ABC
      14: checkcast     #86                 // class java/lang/CharSequence
      17: invokestatic  #255                // Method kotlin/text/StringsKt.toList:(Ljava/lang/CharSequence;)Ljava/util/List;
      20: putstatic     #16                 // Field opponentL:Ljava/util/List;
      23: return
}


typealias Multimap<K, V> = Map<K, List<V>>

fun <K, V> Multimap<K, V>.partition(
    predicate: (V) -> Boolean
): Pair<Multimap<K, V>, Multimap<K, V>> {
    val first = mutableMapOf<K, List<V>>()
    val second = mutableMapOf<K, List<V>>()
    for (k in this.keys) {
        val (firstValuePartition, secondValuePartition) = this[k]!!.partition(predicate)
        first[k] = firstValuePartition
        second[k] = secondValuePartition
    }
    return Pair(first, second)
}

fun <K, V> Multimap<K, V>.toPairsList(): List<Pair<K, V>> = this.flatMap { (k, v) ->
    v.map { k to it }
}

fun <K, V> Multimap<K, V>.flattenValues() = this.values.flatten()

operator fun <K, V> Multimap<K, V>.plus(pair: Pair<K, V>): Multimap<K, V> = if (this.isEmpty()) {
    mapOf(pair.first to listOf(pair.second))
} else {
    val mutableMap = this.toMutableMap()
    val keyValues = mutableMap[pair.first]
    if (keyValues == null) {
        mutableMap[pair.first] = listOf(pair.second)
    } else {
        mutableMap[pair.first] = keyValues + listOf(pair.second)
    }
    mutableMap.toMap()
}

operator fun <K, V> Multimap<K, V>.minus(pair: Pair<K, V>): Multimap<K, V> = if (this.isEmpty()) {
    emptyMap()
} else {
    val valuesForKey = this[pair.first]
        ?.filter { it != pair.second }
        ?.let { if (it.isEmpty()) null else it }
    if (valuesForKey == null) {
        this.filterKeys { it == pair.first }
    } else {
        this.toMutableMap().apply {
            this[pair.first] = valuesForKey - pair.second
        }
            .toMap()
    }
}

fun <K, V> List<Pair<K, V>>.toMultiMap(): Multimap<K, V> {
    var result = mapOf<K, List<V>>()
    forEach {
        result += it
    }
    return result
}

fun <K, V, I> List<I>.toMultiMap(mapper: (I) -> Pair<K, V>): Multimap<K, V> {
    var result = mapOf<K, List<V>>()
    forEach {
        result += mapper(it)
    }
    return result
}

Compiled from "MultimapExt.kt"
public final class MultimapExtKt {
  public static final <K, V> kotlin.Pair<java.util.Map<K, java.util.List<V>>, java.util.Map<K, java.util.List<V>>> partition(java.util.Map<K, ? extends java.util.List<? extends V>>, kotlin.jvm.functions.Function1<? super V, java.lang.Boolean>);
    Code:
       0: aload_0
       1: ldc           #10                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #18                 // String predicate
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: new           #20                 // class java/util/LinkedHashMap
      15: dup
      16: invokespecial #24                 // Method java/util/LinkedHashMap."<init>":()V
      19: checkcast     #26                 // class java/util/Map
      22: astore_2
      23: new           #20                 // class java/util/LinkedHashMap
      26: dup
      27: invokespecial #24                 // Method java/util/LinkedHashMap."<init>":()V
      30: checkcast     #26                 // class java/util/Map
      33: astore_3
      34: aload_0
      35: invokeinterface #30,  1           // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
      40: invokeinterface #36,  1           // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      45: astore        4
      47: aload         4
      49: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      54: ifeq          228
      57: aload         4
      59: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      64: astore        5
      66: aload_0
      67: aload         5
      69: invokeinterface #50,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      74: dup
      75: invokestatic  #54                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      78: checkcast     #56                 // class java/lang/Iterable
      81: astore        7
      83: iconst_0
      84: istore        8
      86: new           #58                 // class java/util/ArrayList
      89: dup
      90: invokespecial #59                 // Method java/util/ArrayList."<init>":()V
      93: astore        9
      95: new           #58                 // class java/util/ArrayList
      98: dup
      99: invokespecial #59                 // Method java/util/ArrayList."<init>":()V
     102: astore        10
     104: aload         7
     106: invokeinterface #60,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     111: astore        11
     113: aload         11
     115: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     120: ifeq          170
     123: aload         11
     125: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     130: astore        12
     132: aload_1
     133: aload         12
     135: invokeinterface #65,  2           // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
     140: checkcast     #67                 // class java/lang/Boolean
     143: invokevirtual #70                 // Method java/lang/Boolean.booleanValue:()Z
     146: ifeq          159
     149: aload         9
     151: aload         12
     153: invokevirtual #74                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     156: goto          166
     159: aload         10
     161: aload         12
     163: invokevirtual #74                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     166: pop
     167: goto          113
     170: new           #76                 // class kotlin/Pair
     173: dup
     174: aload         9
     176: aload         10
     178: invokespecial #79                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     181: astore        6
     183: aload         6
     185: invokevirtual #82                 // Method kotlin/Pair.component1:()Ljava/lang/Object;
     188: checkcast     #84                 // class java/util/List
     191: astore        7
     193: aload         6
     195: invokevirtual #87                 // Method kotlin/Pair.component2:()Ljava/lang/Object;
     198: checkcast     #84                 // class java/util/List
     201: astore        8
     203: aload_2
     204: aload         5
     206: aload         7
     208: invokeinterface #91,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     213: pop
     214: aload_3
     215: aload         5
     217: aload         8
     219: invokeinterface #91,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     224: pop
     225: goto          47
     228: new           #76                 // class kotlin/Pair
     231: dup
     232: aload_2
     233: aload_3
     234: invokespecial #79                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     237: areturn

  public static final <K, V> java.util.List<kotlin.Pair<K, V>> toPairsList(java.util.Map<K, ? extends java.util.List<? extends V>>);
    Code:
       0: aload_0
       1: ldc           #10                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: astore_1
       8: iconst_0
       9: istore_2
      10: aload_1
      11: astore_3
      12: new           #58                 // class java/util/ArrayList
      15: dup
      16: invokespecial #59                 // Method java/util/ArrayList."<init>":()V
      19: checkcast     #114                // class java/util/Collection
      22: astore        4
      24: iconst_0
      25: istore        5
      27: aload_3
      28: invokeinterface #117,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      33: invokeinterface #36,  1           // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      38: astore        6
      40: aload         6
      42: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      47: ifeq          207
      50: aload         6
      52: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      57: checkcast     #119                // class java/util/Map$Entry
      60: astore        7
      62: aload         7
      64: astore        8
      66: iconst_0
      67: istore        9
      69: aload         8
      71: invokeinterface #122,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
      76: astore        10
      78: aload         8
      80: invokeinterface #125,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
      85: checkcast     #84                 // class java/util/List
      88: astore        11
      90: aload         11
      92: checkcast     #56                 // class java/lang/Iterable
      95: astore        12
      97: iconst_0
      98: istore        13
     100: aload         12
     102: astore        14
     104: new           #58                 // class java/util/ArrayList
     107: dup
     108: aload         12
     110: bipush        10
     112: invokestatic  #131                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     115: invokespecial #134                // Method java/util/ArrayList."<init>":(I)V
     118: checkcast     #114                // class java/util/Collection
     121: astore        15
     123: iconst_0
     124: istore        16
     126: aload         14
     128: invokeinterface #60,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     133: astore        17
     135: aload         17
     137: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     142: ifeq          184
     145: aload         17
     147: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     152: astore        18
     154: aload         15
     156: aload         18
     158: astore        19
     160: astore        20
     162: iconst_0
     163: istore        21
     165: aload         10
     167: aload         19
     169: invokestatic  #140                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     172: aload         20
     174: swap
     175: invokeinterface #141,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     180: pop
     181: goto          135
     184: aload         15
     186: checkcast     #84                 // class java/util/List
     189: nop
     190: checkcast     #56                 // class java/lang/Iterable
     193: nop
     194: astore        8
     196: aload         4
     198: aload         8
     200: invokestatic  #145                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     203: pop
     204: goto          40
     207: aload         4
     209: checkcast     #84                 // class java/util/List
     212: nop
     213: areturn

  public static final <K, V> java.util.List<V> flattenValues(java.util.Map<K, ? extends java.util.List<? extends V>>);
    Code:
       0: aload_0
       1: ldc           #10                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokeinterface #170,  1          // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;
      12: checkcast     #56                 // class java/lang/Iterable
      15: invokestatic  #174                // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;
      18: areturn

  public static final <K, V> java.util.Map<K, java.util.List<V>> plus(java.util.Map<K, ? extends java.util.List<? extends V>>, kotlin.Pair<? extends K, ? extends V>);
    Code:
       0: aload_0
       1: ldc           #10                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #180                // String pair
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: invokeinterface #183,  1          // InterfaceMethod java/util/Map.isEmpty:()Z
      18: ifeq          41
      21: aload_1
      22: invokevirtual #186                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      25: aload_1
      26: invokevirtual #189                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      29: invokestatic  #193                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
      32: invokestatic  #140                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      35: invokestatic  #199                // Method kotlin/collections/MapsKt.mapOf:(Lkotlin/Pair;)Ljava/util/Map;
      38: goto          117
      41: aload_0
      42: invokestatic  #203                // Method kotlin/collections/MapsKt.toMutableMap:(Ljava/util/Map;)Ljava/util/Map;
      45: astore_2
      46: aload_2
      47: aload_1
      48: invokevirtual #186                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      51: invokeinterface #50,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      56: checkcast     #84                 // class java/util/List
      59: astore_3
      60: aload_3
      61: ifnonnull     85
      64: aload_2
      65: aload_1
      66: invokevirtual #186                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      69: aload_1
      70: invokevirtual #189                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      73: invokestatic  #193                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
      76: invokeinterface #91,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      81: pop
      82: goto          113
      85: aload_2
      86: aload_1
      87: invokevirtual #186                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      90: aload_3
      91: checkcast     #114                // class java/util/Collection
      94: aload_1
      95: invokevirtual #189                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      98: invokestatic  #193                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
     101: checkcast     #56                 // class java/lang/Iterable
     104: invokestatic  #206                // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Iterable;)Ljava/util/List;
     107: invokeinterface #91,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     112: pop
     113: aload_2
     114: invokestatic  #209                // Method kotlin/collections/MapsKt.toMap:(Ljava/util/Map;)Ljava/util/Map;
     117: areturn

  public static final <K, V> java.util.Map<K, java.util.List<V>> minus(java.util.Map<K, ? extends java.util.List<? extends V>>, kotlin.Pair<? extends K, ? extends V>);
    Code:
       0: aload_0
       1: ldc           #10                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #180                // String pair
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: invokeinterface #183,  1          // InterfaceMethod java/util/Map.isEmpty:()Z
      18: ifeq          27
      21: invokestatic  #218                // Method kotlin/collections/MapsKt.emptyMap:()Ljava/util/Map;
      24: goto          321
      27: aload_0
      28: aload_1
      29: invokevirtual #186                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      32: invokeinterface #50,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      37: checkcast     #84                 // class java/util/List
      40: astore_3
      41: aload_3
      42: ifnull        172
      45: aload_3
      46: checkcast     #56                 // class java/lang/Iterable
      49: astore        5
      51: nop
      52: iconst_0
      53: istore        6
      55: aload         5
      57: astore        7
      59: new           #58                 // class java/util/ArrayList
      62: dup
      63: invokespecial #59                 // Method java/util/ArrayList."<init>":()V
      66: checkcast     #114                // class java/util/Collection
      69: astore        8
      71: iconst_0
      72: istore        9
      74: aload         7
      76: invokeinterface #60,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      81: astore        10
      83: aload         10
      85: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      90: ifeq          142
      93: aload         10
      95: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     100: astore        11
     102: aload         11
     104: astore        12
     106: iconst_0
     107: istore        13
     109: aload         12
     111: aload_1
     112: invokevirtual #189                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     115: invokestatic  #222                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     118: ifne          125
     121: iconst_1
     122: goto          126
     125: iconst_0
     126: ifeq          83
     129: aload         8
     131: aload         11
     133: invokeinterface #141,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     138: pop
     139: goto          83
     142: aload         8
     144: checkcast     #84                 // class java/util/List
     147: nop
     148: astore        6
     150: iconst_0
     151: istore        7
     153: aload         6
     155: invokeinterface #223,  1          // InterfaceMethod java/util/List.isEmpty:()Z
     160: ifeq          167
     163: aconst_null
     164: goto          169
     167: aload         6
     169: goto          173
     172: aconst_null
     173: astore_2
     174: aload_2
     175: ifnonnull     282
     178: aload_0
     179: astore_3
     180: iconst_0
     181: istore        4
     183: new           #20                 // class java/util/LinkedHashMap
     186: dup
     187: invokespecial #24                 // Method java/util/LinkedHashMap."<init>":()V
     190: astore        5
     192: aload_3
     193: invokeinterface #117,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     198: invokeinterface #36,  1           // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     203: astore        6
     205: aload         6
     207: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     212: ifeq          274
     215: aload         6
     217: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     222: checkcast     #119                // class java/util/Map$Entry
     225: astore        7
     227: aload         7
     229: invokeinterface #122,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     234: astore        8
     236: iconst_0
     237: istore        9
     239: aload         8
     241: aload_1
     242: invokevirtual #186                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     245: invokestatic  #222                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     248: ifeq          205
     251: aload         5
     253: aload         7
     255: invokeinterface #122,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     260: aload         7
     262: invokeinterface #125,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     267: invokevirtual #224                // Method java/util/LinkedHashMap.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     270: pop
     271: goto          205
     274: aload         5
     276: checkcast     #26                 // class java/util/Map
     279: goto          321
     282: aload_0
     283: invokestatic  #203                // Method kotlin/collections/MapsKt.toMutableMap:(Ljava/util/Map;)Ljava/util/Map;
     286: astore_3
     287: aload_3
     288: astore        4
     290: iconst_0
     291: istore        5
     293: aload         4
     295: aload_1
     296: invokevirtual #186                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     299: aload_2
     300: checkcast     #56                 // class java/lang/Iterable
     303: aload_1
     304: invokevirtual #189                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     307: invokestatic  #227                // Method kotlin/collections/CollectionsKt.minus:(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/util/List;
     310: invokeinterface #91,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     315: pop
     316: nop
     317: aload_3
     318: invokestatic  #209                // Method kotlin/collections/MapsKt.toMap:(Ljava/util/Map;)Ljava/util/Map;
     321: areturn

  public static final <K, V> java.util.Map<K, java.util.List<V>> toMultiMap(java.util.List<? extends kotlin.Pair<? extends K, ? extends V>>);
    Code:
       0: aload_0
       1: ldc           #10                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aconst_null
       7: astore_1
       8: invokestatic  #218                // Method kotlin/collections/MapsKt.emptyMap:()Ljava/util/Map;
      11: astore_1
      12: aload_0
      13: checkcast     #56                 // class java/lang/Iterable
      16: astore_2
      17: iconst_0
      18: istore_3
      19: aload_2
      20: invokeinterface #60,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      25: astore        4
      27: aload         4
      29: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      34: ifeq          68
      37: aload         4
      39: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      44: astore        5
      46: aload         5
      48: checkcast     #76                 // class kotlin/Pair
      51: astore        6
      53: iconst_0
      54: istore        7
      56: aload_1
      57: aload         6
      59: invokestatic  #248                // Method plus:(Ljava/util/Map;Lkotlin/Pair;)Ljava/util/Map;
      62: astore_1
      63: nop
      64: nop
      65: goto          27
      68: nop
      69: aload_1
      70: areturn

  public static final <K, V, I> java.util.Map<K, java.util.List<V>> toMultiMap(java.util.List<? extends I>, kotlin.jvm.functions.Function1<? super I, ? extends kotlin.Pair<? extends K, ? extends V>>);
    Code:
       0: aload_0
       1: ldc           #10                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc_w         #257                // String mapper
      10: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      13: aconst_null
      14: astore_2
      15: invokestatic  #218                // Method kotlin/collections/MapsKt.emptyMap:()Ljava/util/Map;
      18: astore_2
      19: aload_0
      20: checkcast     #56                 // class java/lang/Iterable
      23: astore_3
      24: iconst_0
      25: istore        4
      27: aload_3
      28: invokeinterface #60,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      33: astore        5
      35: aload         5
      37: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      42: ifeq          82
      45: aload         5
      47: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      52: astore        6
      54: aload         6
      56: astore        7
      58: iconst_0
      59: istore        8
      61: aload_2
      62: aload_1
      63: aload         7
      65: invokeinterface #65,  2           // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
      70: checkcast     #76                 // class kotlin/Pair
      73: invokestatic  #248                // Method plus:(Ljava/util/Map;Lkotlin/Pair;)Ljava/util/Map;
      76: astore_2
      77: nop
      78: nop
      79: goto          35
      82: nop
      83: aload_2
      84: areturn
}


import kotlin.math.max

fun main(args: Array<String>) {
    val problems = listOf("abcabcbb", "bbbbb", "pwwkew", "", "dvdf", "asjrgapa")
    val expected = listOf(3, 1, 3, 0, 3, 6)

    problems.mapIndexed { index, s -> Pair(solution(s), expected.get(index)) }
            .forEach { (result, expected) ->
                println("result = $result, expected = $expected")
                assert(result == expected)
            }

}

fun solution(str: String): Int {
    return maxLength(substring(str))
}

fun substring(str: String): List<String> {
    return if (str.isEmpty())
        listOf()
    else {
        str.fold(mutableListOf<String>()) { acc, ch ->
            if (acc.size == 0) {
                acc.add("$ch")
            } else {
                val tmp = acc[acc.size - 1]
                if (tmp.contains("$ch")) {
                    acc.add("${tmp.drop(tmp.lastIndexOf(ch) + 1)}$ch")
                } else {
                    acc[acc.size - 1] = "$tmp$ch"
                }
            }
            acc
        }
    }
}

fun maxLength(strs: List<String>): Int {
    return strs.map {
        it.length
    }.takeIf {
        it.size >= 2
    }?.reduce { acc, i ->
        max(acc, i)
    }?: run {
       if (strs.isEmpty()) 0
       else strs[0].length
    }
}

Compiled from "LongestSubstringFromChanHo.kt"
public final class LongestSubstringFromChanHoKt {
  public static final void main(java.lang.String[]);
    Code:
       0: aload_0
       1: ldc           #9                  // String args
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: bipush        6
       8: anewarray     #17                 // class java/lang/String
      11: astore_2
      12: aload_2
      13: iconst_0
      14: ldc           #19                 // String abcabcbb
      16: aastore
      17: aload_2
      18: iconst_1
      19: ldc           #21                 // String bbbbb
      21: aastore
      22: aload_2
      23: iconst_2
      24: ldc           #23                 // String pwwkew
      26: aastore
      27: aload_2
      28: iconst_3
      29: ldc           #25                 // String
      31: aastore
      32: aload_2
      33: iconst_4
      34: ldc           #27                 // String dvdf
      36: aastore
      37: aload_2
      38: iconst_5
      39: ldc           #29                 // String asjrgapa
      41: aastore
      42: aload_2
      43: invokestatic  #35                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      46: astore_1
      47: bipush        6
      49: anewarray     #37                 // class java/lang/Integer
      52: astore_3
      53: aload_3
      54: iconst_0
      55: iconst_3
      56: invokestatic  #41                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      59: aastore
      60: aload_3
      61: iconst_1
      62: iconst_1
      63: invokestatic  #41                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      66: aastore
      67: aload_3
      68: iconst_2
      69: iconst_3
      70: invokestatic  #41                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      73: aastore
      74: aload_3
      75: iconst_3
      76: iconst_0
      77: invokestatic  #41                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      80: aastore
      81: aload_3
      82: iconst_4
      83: iconst_3
      84: invokestatic  #41                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      87: aastore
      88: aload_3
      89: iconst_5
      90: bipush        6
      92: invokestatic  #41                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      95: aastore
      96: aload_3
      97: invokestatic  #35                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     100: astore_2
     101: aload_1
     102: checkcast     #43                 // class java/lang/Iterable
     105: astore_3
     106: iconst_0
     107: istore        4
     109: aload_3
     110: astore        5
     112: new           #45                 // class java/util/ArrayList
     115: dup
     116: aload_3
     117: bipush        10
     119: invokestatic  #49                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     122: invokespecial #53                 // Method java/util/ArrayList."<init>":(I)V
     125: checkcast     #55                 // class java/util/Collection
     128: astore        6
     130: iconst_0
     131: istore        7
     133: iconst_0
     134: istore        8
     136: aload         5
     138: invokeinterface #59,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     143: astore        9
     145: aload         9
     147: invokeinterface #65,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     152: ifeq          232
     155: aload         9
     157: invokeinterface #69,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     162: astore        10
     164: aload         6
     166: iload         8
     168: iinc          8, 1
     171: istore        11
     173: iload         11
     175: ifge          181
     178: invokestatic  #73                 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     181: iload         11
     183: aload         10
     185: checkcast     #17                 // class java/lang/String
     188: astore        12
     190: istore        13
     192: astore        15
     194: iconst_0
     195: istore        14
     197: new           #75                 // class kotlin/Pair
     200: dup
     201: aload         12
     203: invokestatic  #79                 // Method solution:(Ljava/lang/String;)I
     206: invokestatic  #41                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     209: aload_2
     210: iload         13
     212: invokeinterface #85,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     217: invokespecial #88                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     220: aload         15
     222: swap
     223: invokeinterface #92,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     228: pop
     229: goto          145
     232: aload         6
     234: checkcast     #81                 // class java/util/List
     237: nop
     238: checkcast     #43                 // class java/lang/Iterable
     241: astore_3
     242: nop
     243: iconst_0
     244: istore        4
     246: aload_3
     247: invokeinterface #59,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     252: astore        5
     254: aload         5
     256: invokeinterface #65,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     261: ifeq          390
     264: aload         5
     266: invokeinterface #69,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     271: astore        6
     273: aload         6
     275: checkcast     #75                 // class kotlin/Pair
     278: astore        7
     280: iconst_0
     281: istore        8
     283: aload         7
     285: invokevirtual #95                 // Method kotlin/Pair.component1:()Ljava/lang/Object;
     288: checkcast     #97                 // class java/lang/Number
     291: invokevirtual #101                // Method java/lang/Number.intValue:()I
     294: istore        9
     296: aload         7
     298: invokevirtual #104                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     301: checkcast     #97                 // class java/lang/Number
     304: invokevirtual #101                // Method java/lang/Number.intValue:()I
     307: istore        10
     309: new           #106                // class java/lang/StringBuilder
     312: dup
     313: invokespecial #108                // Method java/lang/StringBuilder."<init>":()V
     316: ldc           #110                // String result =
     318: invokevirtual #114                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     321: iload         9
     323: invokevirtual #117                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     326: ldc           #119                // String , expected =
     328: invokevirtual #114                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     331: iload         10
     333: invokevirtual #117                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     336: invokevirtual #123                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     339: getstatic     #129                // Field java/lang/System.out:Ljava/io/PrintStream;
     342: swap
     343: invokevirtual #135                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     346: iload         9
     348: iload         10
     350: if_icmpne     357
     353: iconst_1
     354: goto          358
     357: iconst_0
     358: istore        11
     360: getstatic     #141                // Field kotlin/_Assertions.ENABLED:Z
     363: ifeq          385
     366: iload         11
     368: ifne          385
     371: ldc           #143                // String Assertion failed
     373: astore        12
     375: new           #145                // class java/lang/AssertionError
     378: dup
     379: aload         12
     381: invokespecial #147                // Method java/lang/AssertionError."<init>":(Ljava/lang/Object;)V
     384: athrow
     385: nop
     386: nop
     387: goto          254
     390: nop
     391: return

  public static final int solution(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #174                // String str
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokestatic  #178                // Method substring:(Ljava/lang/String;)Ljava/util/List;
      10: invokestatic  #182                // Method maxLength:(Ljava/util/List;)I
      13: ireturn

  public static final java.util.List<java.lang.String> substring(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #174                // String str
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #185                // class java/lang/CharSequence
      10: invokeinterface #188,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      15: ifne          22
      18: iconst_1
      19: goto          23
      22: iconst_0
      23: ifeq          32
      26: invokestatic  #192                // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
      29: goto          258
      32: aload_0
      33: checkcast     #185                // class java/lang/CharSequence
      36: astore_1
      37: new           #45                 // class java/util/ArrayList
      40: dup
      41: invokespecial #193                // Method java/util/ArrayList."<init>":()V
      44: checkcast     #81                 // class java/util/List
      47: astore_2
      48: nop
      49: iconst_0
      50: istore_3
      51: aload_2
      52: astore        4
      54: iconst_0
      55: istore        5
      57: iload         5
      59: aload_1
      60: invokeinterface #188,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      65: if_icmpge     256
      68: aload_1
      69: iload         5
      71: invokeinterface #197,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
      76: istore        6
      78: aload         4
      80: iload         6
      82: istore        7
      84: astore        8
      86: iconst_0
      87: istore        9
      89: aload         8
      91: invokeinterface #200,  1          // InterfaceMethod java/util/List.size:()I
      96: ifne          115
      99: aload         8
     101: iload         7
     103: invokestatic  #203                // Method java/lang/String.valueOf:(C)Ljava/lang/String;
     106: invokeinterface #204,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     111: pop
     112: goto          246
     115: aload         8
     117: aload         8
     119: invokeinterface #200,  1          // InterfaceMethod java/util/List.size:()I
     124: iconst_1
     125: isub
     126: invokeinterface #85,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     131: checkcast     #17                 // class java/lang/String
     134: astore        10
     136: aload         10
     138: checkcast     #185                // class java/lang/CharSequence
     141: iload         7
     143: invokestatic  #203                // Method java/lang/String.valueOf:(C)Ljava/lang/String;
     146: checkcast     #185                // class java/lang/CharSequence
     149: iconst_0
     150: iconst_2
     151: aconst_null
     152: invokestatic  #210                // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z
     155: ifeq          209
     158: aload         8
     160: new           #106                // class java/lang/StringBuilder
     163: dup
     164: invokespecial #108                // Method java/lang/StringBuilder."<init>":()V
     167: aload         10
     169: aload         10
     171: checkcast     #185                // class java/lang/CharSequence
     174: iload         7
     176: iconst_0
     177: iconst_0
     178: bipush        6
     180: aconst_null
     181: invokestatic  #214                // Method kotlin/text/StringsKt.lastIndexOf$default:(Ljava/lang/CharSequence;CIZILjava/lang/Object;)I
     184: iconst_1
     185: iadd
     186: invokestatic  #218                // Method kotlin/text/StringsKt.drop:(Ljava/lang/String;I)Ljava/lang/String;
     189: invokevirtual #114                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     192: iload         7
     194: invokevirtual #221                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     197: invokevirtual #123                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     200: invokeinterface #204,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     205: pop
     206: goto          246
     209: aload         8
     211: aload         8
     213: invokeinterface #200,  1          // InterfaceMethod java/util/List.size:()I
     218: iconst_1
     219: isub
     220: new           #106                // class java/lang/StringBuilder
     223: dup
     224: invokespecial #108                // Method java/lang/StringBuilder."<init>":()V
     227: aload         10
     229: invokevirtual #114                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     232: iload         7
     234: invokevirtual #221                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     237: invokevirtual #123                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     240: invokeinterface #225,  3          // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;
     245: pop
     246: aload         8
     248: astore        4
     250: iinc          5, 1
     253: goto          57
     256: aload         4
     258: areturn

  public static final int maxLength(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: ldc           #238                // String strs
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #43                 // class java/lang/Iterable
      10: astore_2
      11: iconst_0
      12: istore_3
      13: aload_2
      14: astore        4
      16: new           #45                 // class java/util/ArrayList
      19: dup
      20: aload_2
      21: bipush        10
      23: invokestatic  #49                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      26: invokespecial #53                 // Method java/util/ArrayList."<init>":(I)V
      29: checkcast     #55                 // class java/util/Collection
      32: astore        5
      34: iconst_0
      35: istore        6
      37: aload         4
      39: invokeinterface #59,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      44: astore        7
      46: aload         7
      48: invokeinterface #65,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      53: ifeq          99
      56: aload         7
      58: invokeinterface #69,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      63: astore        8
      65: aload         5
      67: aload         8
      69: checkcast     #17                 // class java/lang/String
      72: astore        9
      74: astore        11
      76: iconst_0
      77: istore        10
      79: aload         9
      81: invokevirtual #239                // Method java/lang/String.length:()I
      84: invokestatic  #41                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      87: aload         11
      89: swap
      90: invokeinterface #92,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      95: pop
      96: goto          46
      99: aload         5
     101: checkcast     #81                 // class java/util/List
     104: nop
     105: astore_2
     106: aload_2
     107: astore_3
     108: iconst_0
     109: istore        4
     111: aload_3
     112: invokeinterface #200,  1          // InterfaceMethod java/util/List.size:()I
     117: iconst_2
     118: if_icmplt     125
     121: iconst_1
     122: goto          126
     125: iconst_0
     126: ifeq          133
     129: aload_2
     130: goto          134
     133: aconst_null
     134: astore_1
     135: aload_1
     136: ifnull        250
     139: aload_1
     140: checkcast     #43                 // class java/lang/Iterable
     143: astore_3
     144: nop
     145: iconst_0
     146: istore        4
     148: aload_3
     149: invokeinterface #59,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     154: astore        5
     156: aload         5
     158: invokeinterface #65,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     163: ifne          176
     166: new           #241                // class java/lang/UnsupportedOperationException
     169: dup
     170: ldc           #243                // String Empty collection can\'t be reduced.
     172: invokespecial #246                // Method java/lang/UnsupportedOperationException."<init>":(Ljava/lang/String;)V
     175: athrow
     176: aload         5
     178: invokeinterface #69,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     183: astore        6
     185: aload         5
     187: invokeinterface #65,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     192: ifeq          239
     195: aload         6
     197: aload         5
     199: invokeinterface #69,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     204: checkcast     #97                 // class java/lang/Number
     207: invokevirtual #101                // Method java/lang/Number.intValue:()I
     210: istore        7
     212: checkcast     #97                 // class java/lang/Number
     215: invokevirtual #101                // Method java/lang/Number.intValue:()I
     218: istore        8
     220: iconst_0
     221: istore        9
     223: iload         8
     225: iload         7
     227: invokestatic  #252                // Method java/lang/Math.max:(II)I
     230: nop
     231: invokestatic  #41                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     234: astore        6
     236: goto          185
     239: aload         6
     241: checkcast     #97                 // class java/lang/Number
     244: invokevirtual #101                // Method java/lang/Number.intValue:()I
     247: goto          279
     250: iconst_0
     251: istore_3
     252: aload_0
     253: invokeinterface #255,  1          // InterfaceMethod java/util/List.isEmpty:()Z
     258: ifeq          265
     261: iconst_0
     262: goto          278
     265: aload_0
     266: iconst_0
     267: invokeinterface #85,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     272: checkcast     #17                 // class java/lang/String
     275: invokevirtual #239                // Method java/lang/String.length:()I
     278: nop
     279: ireturn
}