title: Output Arraylist String without brackets and commas
body: <p>I'm trying to write a program that reads a string of text and prints all digrams in this text and their frequencies. </p>
  
  <p>Example of input: <code>park car at the parking lot</code></p>
  
  <p>Corresponding output: <code>ar:3 pa:2 rk:2 at:1 ca:1 he:1 in:1 ki:1 lo:1 ng:1 ot:1 th:1</code></p>
  
  <p>When I try this sample input, it outputs <code>[ar:3, pa:2, rk:2, ca:1, at:1, th:1, he:1, ki:1, in:1, ng:1, lo:1, ot:1]</code></p>
  
  <p>How do I fix this so it wont have brackets and commas?</p>
  
  <pre><code>public class Digrams {
  
  public static void main(String args[]) {
      Scanner scan = new Scanner(System.in);
  
      String str = scan.nextLine();
  
      ArrayList&lt;String&gt; repetition = new ArrayList&lt;String&gt;();
      ArrayList&lt;String&gt; digrams = new ArrayList&lt;String&gt;();
      String digram;
  
      for (int i = 0; i &lt; str.length() - 1; i++) {
          digram = str.substring(i, i + 2);
          if (repetition.contains(digram) || digram.contains(" ") || digram.length() &lt; 2) {
              continue;
          }
          int occurances = (str.length() - str.replace(digram, "").length()) / 2;
          digrams.add(digram + ":" + occurances);
          repetition.add(digram);
      }
  
      Collections.sort(digrams, (s1, s2) -&gt; s2.substring(3, 4).compareTo(s1.substring(3, 4)));
  
      System.out.println(digrams);
    }
  }
  </code></pre>