title: create a sitting arrangement using javascript(node.js)
body: <p>I have given a row of seats. Each seat is either occupied by a woman (denoted by xx) or a man (denoted by xy).</p>
  
  <p>The objective is to find the minimum number of seat exchanges required such that the men and women are seated alternately.</p>
  
  <p><strong>Input Format</strong></p>
  
  <p>The first line of input consists of an integer <code>t</code> denoting the number of test cases. <code>t</code> test cases follow. Each test case consists of two lines. The first line of each test case consists of an integer n denoting the number of seats. Second line consists of n space separated tokens, each token denoting the occupant of that particular seat.</p>
  
  <p><strong>Output Format</strong></p>
  
  <p>For each test case, print the number of seat exchanges required. If an alternate seating is impossible, print -1.</p>
  
  <p><strong>Sample Input</strong></p>
  
  <pre><code>5
  3
  xx xx xx
  2
  xx xy
  4
  xx xx xy xy
  8
  xx xx xy xy xy xx xx xy
  7
  xx xy xx xy xx xy xy
  </code></pre>
  
  <p><strong>Sample Output</strong></p>
  
  <pre><code>-1
  0
  1
  2
  3
  </code></pre>
  
  <p>Constraints
  1 &lt;= t &lt;= 1000</p>
  
  <p>1 &lt;= n &lt;= 10000</p>
  
  <p><strong>Explanation</strong>
  For xx xx xy xy, one can exchange seat 1 with seat 4 giving xy xx xy xx giving an alternate seating arrangement.</p>