Convert 2D array to 1D array of column strings
<p>I'm working on a java program that has the following input:</p>

<pre><code>A V V V VV V V V
E F V E VF E V E
C D V C VD B V C
A A V A VA G V A
V D V V VD E V V
A V V A VV V V A
</code></pre>

<p>and the following output:</p>

<pre><code>R
R

R
 R
R

R
</code></pre>

<p>So an <code>R</code> has to be printed if a column contains minimal one letter <code>A-G</code>, but a space has to be printed if there are only <code>V</code>'s in the column. The code I have is:</p>

<pre class="lang-java prettyprint-override"><code>Scanner inputc2 = new Scanner (new File("internalc"));
int sss = 0;

for (int i = 0; i &lt; n; i++) {
 for (int j = 0; j &lt; m; j++) {
  try{
     matrix2[i][j] = inputc2.useDelimiter(" ").next().replaceAll(",", " ");
       System.out.println(matrix2[i][j]);
       temp2[sss] = matrix2[i][j];//change this

        if(temp2[sss].indexOf("N") &gt;= 0){
         pc2.println(temp2[sss].replaceAll("N","R"));
        }
        if(temp2[sss].indexOf(' ') &gt;= 0){
         pc2.println(temp2[sss]);
        } 
        sss++;

     }
     catch (java.util.NoSuchElementException e) {
         // e.printStackTrace();
     }
   }

}
</code></pre>

<p>In the current program the temp2[sss] is exactly the same as matrix2[i][j], but it must be strings of columns. I hope that you can help me.</p>

<p>Kind regards,
Bjorn</p>
