Bisus

Untitled

Dec 22nd, 2019
95
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int function(char **a, int n)
  2. {
  3.     int i, j, counter = 0, will_be_removed = 0;
  4.  
  5.     for( i = 1; i<n; i++ )
  6.     {
  7.         if( strpbrk(a[i], a[i - 1]) )
  8.         {
  9.             will_be_removed++;
  10.             continue;
  11.         }
  12.         if( will_be_removed )
  13.         {
  14.             for( j = 0; j<will_be_removed; j++)
  15.             {
  16.                 free(a[i - 1 - j]);
  17.             }
  18.             will_be_removed = 0;
  19.         }
  20.         a[counter] = a[i];
  21.         counter++;
  22.     }
  23.     return counter;
  24. }
RAW Paste Data