title: Removing consecutive repeated characters in a string in C++
body: <p>Its a string problem.First remove all repeated consecutive substring with length 1,then delete substring of length 2 and so on...
  for eg if we have a string like this -> abcababceccced
  After removing substring of length 1 we will get abcababceced
  After removing substring of length 2 we will get abcabced
  After removing substring of length 3 we will get abced
  This will be the final output</p>
  
  <p>I have devised an algorithm but it has has a complexity of O(n3) and this is not desirable at all.My algorithm is as follows</p>
  
  <pre><code>char str[20]="abcababceccced";
  int len=strlen(a);
   for(i=1;i&lt;=len/2;i++){
       for(j=0;j&lt;len;){
        bool flag=chk(a,j,i);//this function will check whether the substring starting at a[j] and a[j+i] of length i are same or not.
         if(flag){
          //remove the second same substring.
         }
         else 
           j=j+i;
        }
    }
  </code></pre>
  
  <p>I will be very grateful if someone comes up with a less complex algo in C++ for this certain problem.</p>