//Gregory Pylypovych
//Bergen COunty Academies
//Senior

#include 
#include 
#include 
#include 
#include 
using namespace std;
int cont=0;
string temp1;
string temp2;
string temp3;
string temp4;
string maxstring;
int maxlength;
int pos1, pos2;
void recursive_split(string a, string b){
	maxlength=0;
	maxstring="";
	pos1=-1;
	pos2=-1;
	for(int i=0; imaxlength || (length==maxlength && temp1.compare(maxstring)<0) ) ){
						maxlength=length;
						maxstring=temp1;
						pos1=i;
						pos2=j;
					}
				}
			}
		}
	}
	// cout<maxlength || (length==maxlength && temp1.compare(maxstring)<0) ) ){
						maxlength=length;
						maxstring=temp1;
						pos1=i;
						pos2=j;
					}
				}
			}
		}
	}
	if(pos1!=-1){
		// cont+=maxlength;
		// temp1=a.substr(0, pos1);
		temp2=a.substr(pos1+maxlength, a.length()-pos1-maxlength);
		// temp3=b.substr(0, pos2);
		temp4=b.substr(pos2+maxlength, b.length()-pos2-maxlength);
		// if(temp1.length()*temp3.length()!=0){
		// 	recursive_split(temp1, temp3);
		// }
		if(temp2.length()*temp4.length()!=0){
			recursive_split(temp2, temp4);
		}
	}
}
int main() {
	ifstream fin ("2sr_sampledata.txt");
	string A, B, C, D;
	for(int r=0; r<5; r++){
		cont=0;
		getline(fin, A);
		getline(fin, B);
		C="";
		D="";
		int tempq=0;
		for(int i=0; i