"use strict";

var assert = require('assert');


var largestString = function(words) {
  if (words && words.length > 1) {
    return words.reduce(function(x,y) {
      return Math.max(x,y.length); 
    }, words[0].length);
  }
};

var eliminateSubstrings = function(words) {
  var rest = [];

  return rest;
};

describe('words smushing', function() {
  describe('largest string', function() {
    it('is not defined for 0 length arrays', function() {
      assert(!largestString([]));
    });

    it('returns the length of the longest string', function() {
      assert.equal(5, largestString(['a','b','bc','defgh']));
    });
  });

  describe('eliminate wholly contains substrings', function() {
    it('duplicates are eliminated', function() {
      assert.equal(1, eliminateSubstrings(['test','testing']).length);
    });
  });
});

@@ -285,16 +285,318 @@
 t = %5B%5D;%0A
+  var n = words.length;%0A%0A  for (var i=0;i%3Cn;++i) %7B%0A    var subString = false;%0A    for (var j=0;j%3Cn;++j) %7B%0A      if (i == j) %7B %0A        continue;%0A      %7D%0A%0A      if (words%5Bj%5D.indexOf(words%5Bi%5D) !== -1) %7B%0A        subString = true;%0A      %7D%0A    %7D%0A%0A    if (!subString) %7B%0A      rest.push(words%5Bi%5D);%0A    %7D%0A  %7D%0A%0A
 %0A  retur

eliminate sub strings