I'm looking for a way to implement a cluster algorithm that should be able to clusterize string arrays. 

Assuming inputs like those:

```
string[][] input =
{
     new string[] { "A", "B", "C", "D", "F", "G"},
     new string[] { "D", "F", "G", "H"},
     new string[] { "A", "B", "C", "G"},
     new string[] { "B", "C", "Z", "A", "F"},
     new string[] { "O", "N", "P", "X"}
};

```

The algorithm should be able to identify that item 0, 2 and 3 are at the same cluster. But how can i do this? 

***What I've tried?***
I've been trying to use Accord.net framework to build a KMeans cluster. But I noticed that Kmeans only work with double numbers (so I converter each value in the string[] to a number an tried again). 
As distance meansurement I implemented [Jaccard](https://en.wikipedia.org/wiki/Jaccard_index) distance.

After this I'm getting an error that says that "The points matrix should be rectangular." That makes sense because my inputs are not a rectangular matrix. 

So I ask you guys: How could I implement this? Whats the best approach to cluster items in such situation? Any thoughts or suggestions?

Code sample:

```
double[][] inputs =
{
     new double [] { 0, 1, 2, 3, 4 },
     new double [] { 0, 1, 5, 2, 3, 4 },
     new double [] { 33, 0, 1, 5, 2, 4 },
     new double [] { 0, 1, 2, 6, 7,  8},
     new double [] { 0, 9, 1, 2, 6, 8 },
     new double [] { 0, 4, 10, 15, 11, 12, 13  },
     new double [] { 0, 4, 14, 15, 11, 12, 13, 16  },
     new double [] { 0, 17, 18, 11, 19, 12, 20},
     new double [] { 0, 17, 18, 11, 19, 12, 20, 15, 26},
     new double [] { 0, 4, 14, 15, 11, 12, 13, 16, 17, 18  },
     new double [] { 0, 21, 22, 23, 24, 26, 25},
     new double [] { 24, 26, 27, 21, 28, 29, 1},
     new double [] { 24, 243, 26, 30},
     new double [] { 31, 24, 22, 23, 0, 11, 26 }
     // Many others... 
};

var kmeans   = new KMeans(k: 3, distance: new JaccarDistanceDouble() );
var clusters = kmeans.Learn(inputs); // Throws the error.
int[] labels = clusters.Decide(inputs);

```