简单题
#include <iostream>
#include <string>
using namespace std;
int main()
{
int num;
while(1)
{
cin >> num;
if(!num) break;
string people,nobeds;
cin >> people;
string beds;
int times = 0;
for(string::iterator it = people.begin();it != people.end();it++)
{
if(beds.find(*it) != string::npos)
{
for(string::iterator it2 = beds.begin();it2 != beds.end();it2++)
if(*it2 == *it)
{
beds.erase(it2);
break;
}
}
else if(beds.size() == num)
{
if(nobeds.find(*it) != string::npos)
times ++;
else nobeds += *it;
}
else if(beds.size() < num)
beds += *it;
}
if(times)
cout << times << " customer(s) walked away." <<endl;
else cout << "All customers tanned successfully." << endl;
}
return 0;
}