i_luv_c++ 26 Light Poster

hey guys im working on a project which requires two tasks
1) count the total number of clumps in a program which i already accomplished.
2)find the longest clump in the string and output it(for example if string is aaaabbbcccccccc so the longest clump is cccccccc

>>clump is string of letters>>For example if you pick the minimum clump length to be 2 than >>aaabcndxx<<has two clumps >>aaa<<and >>xx<< and longest clump is aaa .. I'm having trouble outputing the longest clump

#include <iostream>
#include <string>
using namespace std;
int countClumps(int k, string s, string & longest);
int main ()
{
	string string1, string2;
	int length;
	char play;
	do
	{
		cout << "Enter a minmum clump length of 2 or more: ";
		cin >> length;
		while (length <= 1)
		{
			cout << "ILLEGAL VALUE!!!!" << endl;
			cout << "Please Enter a minmum clump length of 2 or more:";
			cin >> length;
		}
		cout << "Enter one or more words each having at least ";
		cout << "2 characters. When you want to quit, enter any word with fewer than 2 characters." << endl;
		cin >> string1;
		cout << "total number of clumps: "countClumps(length, string1, string2) << endl;
		cout << "longest clump is " << string2 << endl;
		cout << "play again";
		cin >> play;
	}
	while (play != 'n');
	return 0;
}
int countClumps(int minimum_clump, string string1, string & longest)
{
	longest = "";	//to determine the longest clump
	
	int max = 1, min = 0, total = 0;	//min and max counts the string to determine the clumps
	while (min < string1.length())
	{
		while (max < string1.length() && string1[min] == string1[max]) 
		{
			max++;
		}
		int total_clump = max - min;
		if (total_clump >= minimum_clump)
			total++;
	
		min = max;	//g 
	}
	return total;	//return the total number of clumps to function

}
Fbody commented: You already asked this in another thread. +0