function __echo_clades (key, value) {
    fprintf (stdout, "\t", value, "\n");
}

goOn = 1;
while (goOn) {

	if (promptFor2ndRegExp) {
		fprintf (stdout,"\nEnter a regular expression to define the first clade:");
		fscanf  (stdin,"String",theRegExp);
		fprintf (stdout,"\nEnter a regular expression to define the second clade:");
		fscanf  (stdin,"String",theRegExp2);

	}
	else {
		fprintf (stdout,"\nEnter a reg exp to separate the sequences into two clades:");
		fscanf  (stdin,"String",theRegExp);
	}

	cladeA = {};
	cladeB = {};

	for (specIndex = 0; specIndex < ds.species; specIndex += 1) {
		GetString (specName, ds, specIndex);
		specMatch = specName $ theRegExp;

		if (specMatch[0]>=0) {
			cladeA [specIndex] = specName;
		}
		else
		{
			if (promptFor2ndRegExp) {
				specMatch = specName $ theRegExp2;
				if (specMatch[0] < 0) {
					continue;
				}
			}
			cladeB [specIndex] = specName;
		}
	}

    st1 = Join (",", Columns (cladeA));
    st2 = Join (",", Columns (cladeB));

	st1 = "(("+st1+"),"+st2+")";

	Topology splitTop = st1;

	clASize = Abs (cladeA);
	clBSize = Abs (cladeB);

	if (clASize == 0 || clBSize == 0) {
		fprintf (stdout, "\nERROR: invalid sequence partitionings - one of the clades is empty or there were duplicate sequence names\n");
		return 0;
	}

	fprintf (stdout, "\n\nClade 1 includes ", clASize," sequences:\n");
	cladeA ["__echo_clades"][""];
	fprintf (stdout, "\n\nClade 2 includes ", clBSize," sequences:\n");
	cladeB ["__echo_clades"][""];

    if (skipConfirm) {break;}
	fprintf (stdout, "\nIs this partitioning correct (y/n)");
	fscanf (stdin, "String", goOn);
	goOn = (goOn[0] == "n" || goOn[0] == "N");
}
