title: How can i simplify this code in kotlin?
body: <p>I am doing a program and I need to read input from two <code>.txt</code> files. But I know there is a simpler a way than duplicating the code. I already wrote this:</p>
  
  <pre><code>import java.io.File
  
  fun chamadas (args: Array&lt;String&gt;) {
  val ficheiro1 = "voos.txt"
  val ficheiro2 = "reservas.txt"
  
      val linha1 = File(ficheiro1).readLines()
      for (line in linha1) {
          val parts = line.split(':')
          val flightNumber = parts[0]
          val origin = parts[1]
          val destination = parts[2]
          val date = parts[3]
      }
  
      val linha2 = File(ficheiro2).readLines()
      for (line in linha2) {
          val parts = line.split(':')
          val id = parts[0]
          val nameSurname = parts[1]
          val flightNumber = parts[2]
          val date = parts[3]
    }
  }
  </code></pre>
  
  <p>The <code>.txt</code> files are of this type:</p>
  
  <p><code>voos.txt</code> -> <code>&lt;FlightNumber&gt;:&lt;Origin&gt;:&lt;Destination&gt;:&lt;Date&gt;</code></p>
  
  <p><code>reservas.txt</code> -> <code>&lt;ID&gt;:&lt;Name and Surname&gt;:&lt;FlightNumber&gt;:&lt;Date&gt;</code></p>
  
  <p>The date won't be in <code>DD/MM/YYYY</code> format, it will only be a number ranging from 1-31. Any ideas on how should i simplify the code?</p>