#include #include #include #include #include using namespace std; string make_lower_case( string nm ) { int sz = nm.size(); for ( int i = 0; i < sz; i++ ) nm[ i ] = tolower( nm[ i ] ); return nm; } int main() { int n; vector< string > names; fstream fl, fo; fl.open( "class.in", ios::in ); fl >> n; //cout << n << endl; system("pause"); string current; for ( int i = 0; i < n; i++ ) { fl >> current; current = make_lower_case( current ); names.push_back( current ); } fl.close(); //for ( int i = 0; i < n; i++ ) cout << names[ i ] << endl; sort( names.begin(), names.end() ); int br_min = 2002, br_max = 0, br; int sz = names.size(); int j; for ( int i = 0; i < sz; ) { br = 0; for ( j = i; j < sz; j++ ) { if ( names[ i ] == names[ j ] ) br++; else break; } if ( br < br_min ) br_min = br; if ( br > br_max ) br_max = br; i = j; } fo.open( "class.out", ios::out ); //cout << br_max << " " << br_min << endl; fo << br_max << " " << br_min << endl; fo.close(); //system("pause"); return 0; }