title: How to display items without showing duplicates
body: <p>I try to create a tree of files with indentation <strong>without displaying duplicate files.</strong>
  Currently I have done this:</p>
  <pre><code>val listOfDisplayPaths : List&lt;String&gt; = listOf(
          &quot;/home/josh/project/app/src/index.js&quot;,
          &quot;/home/josh/project/app/images/logo.png&quot;,
          &quot;/home/peter/.bashrc&quot;,
          &quot;/var/log&quot;,
          &quot;/usr/lib/node14&quot;,
          &quot;/opt/apache2&quot;,
          &quot;/etc/hosts&quot;
  )
  
  fun displayPaths(paths: List&lt;String&gt;): String {
      val sb = StringBuilder()
      var pathIndented = &quot;&quot;
  
      for (p in paths) {
          val path = p.split(&quot;/&quot;)
          
          for (file in path){
              val index = path.indexOf(file)
              val pathWithoutIndent = sb.append(file + &quot;\n&quot;)
              val space = addSpace(index)
              pathIndented = sb.append(String.format(space, pathWithoutIndent)).toString()
          }
      }
      return pathIndented
  }
  
  fun addSpace(index: Int): String {
      if (index == 0){
          return &quot;- &quot;
      }
      val space = &quot;    &quot;
      return space.repeat(index)
  }
  
  fun main(vararg args: String) {
      displayPaths(listOfDisplayPaths)
  }
  </code></pre>
  <p>Current result:</p>
  <pre><code>- home
      josh
          project
              app
                  src
                      index.js
                          
  - home
      josh
          project
              app
                  images
                      logo.png
                          
  - home
      peter
          .bashrc
              
  - var
      log
          
  - usr
      lib
          node14
              
  - opt
      apache2
          
  - etc
      hosts
  </code></pre>
  <p>Expected result:</p>
  <pre><code>- home
      josh
          project
              app
                  src
                      index.js
                  images
                      logo.png
      peter
         bashrc
  - var
      log
  - usr
      lib
          node14
  - opt
      apache2
  - etc
      hosts
  </code></pre>
  <p><strong>How to not display duplicate file titles while keeping the current indentation ?</strong></p>
  <p>I also have this warning without using print:</p>
  <pre><code>solution.kt:88:17: warning: parameter 'args' is never used fun main(vararg args: String){
                                                                      ^
  </code></pre>
  <p>How can I solve it?</p>
  <p>EDIT: I have replaced</p>
  <pre><code>fun main(vararg args: String) {
      displayPaths(listOfDisplayPaths)
  }
  </code></pre>
  <p>By:</p>
  <pre><code>fun main() {
      displayPaths(listOfDisplayPaths)
  }
  </code></pre>
  <p>To solve the warning</p>
  <p>Thanks by advance</p>