title: Finding the number of visible clothes in rope
body: <p>Question: Count the Clothes Visible</p>
  
  <p>A lady recently hired a maid to look after her household work so that she can concentrate on setting up her new business. As part of the routine work, the maid cleans the house and washes the clothes every day.</p>
  
  <p>However, there is a problem with the drying of clothes on the rope. Since the rope is small and all the clothes are not able to be spread out properly, the maid places one cloth on top of other cloth. So some of the clothes are covered - partially or completely - by the other ones. Knowing the order and the position in which the clothes were hung, determine how many clothes are visible (partially or completely) when seen from front.</p>
  
  <p>Consider the rope was of length N meters divided into N equal sections starting from 0 to N. Each cloth of width P occupies one or more than one section completely. (1&lt;=P&lt;=N &amp; P is a +ve integer).</p>
  
  <p>(Note: Ignore the other dimension of cloth for the purpose of this problem)
  Input Specifications
  Your program must read three arguments RopeLength, CountofClothes, ClothesPosition[] where
  RopeLength is the length of the rope in meters (1&lt;=RopeLength&lt;=10000)
  CountofClothes is the number of clothes which are placed on the rope (1&lt;=CountofClothes&lt;=10000)
  ClothesPosition is an array giving the position in which the clothes were hung. The cloth position is described by two integers L and W, where L represents the start position of where the cloth was hung (0&lt;=L&lt;=10000) and W is the width of the cloth (1&lt;=W&lt;=10000).</p>
  
  <p>The order in which the input is received is the order in which the clothes are placed on the rope.
  Output Specifications
  Your function GetVisibleCount should set the output variable 'output1' to the count of clothes visible completely or partially.</p>
  
  <p>Example
  Sample input:</p>
  
  <pre><code>10:5:{{0,4},{6,3},{1,5},{6,4},{7,2}}
  </code></pre>
  
  <p>Here 10 is the length of the rope in meters. 5 is the number of clothes hung on rope. The first cloth starts from 0 and covers 4 sections from 0. The second cloth starts at 6 and covers 3 sections from 6 and so on..
  Sample output:</p>
  
  <pre><code>4
  </code></pre>
  
  <p>The total number of clothes visible when seen from front is 4.</p>