# Weekly Problem #8

This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2002, TopCoder, Inc. All rights reserved.

### Problem Statement

A health club chain allows its members to visit any of its many health club locations an unlimited number of times per day. The only constraining rule is, a customer can only visit one health club location per day, even though he or she may return to that location an unlimited number of times for the rest of that day.

Although the honor system has always worked quite well, the club wants to run some tests to see how many people really follow the rules. You are to write a program that takes the entrance log files from three different clubs (all logging the same day) and return a sorted list of the people who are not honest and went to more than one health club location in the same day.

The log files are represented as tvector<string>'s where each element is the member name of a customer who entered that day. For example, if a customer showed up three times to one of the club locations that day, the member's name would appear three times in the corresponding tvector<string>.

### Definition

• Class: MemberCheck
• Method: whosDishonest
• Parameters: ```const tvector<string>&, const tvector<string>&, const tvector<string>&```
• Returns: `tvector<string>`
• Method signature:
```    tvector<string> whosDishonest(const tvector<string>& club1, const tvector<string>& club2, const tvector<string>&  club3)
```
(be sure your method is public)

### Class

#include <string> using namespace std; #include "tvector.h" class MemberCheck { public: tvector<string> whosDishonest(const tvector<string>& club1, const tvector<string>& club2, const tvector<string>& club3) { // fill in code here } };

### Notes

• club1, club2, and club3 may contain a different number of elements.

• The same member name can appear multiple times in a single log file.
• The elements of the returned `tvector<string>` should be sorted in lexicographic order (the order they would appear in a dictionary).

• Assume that two people with the same name are in fact the same person.

### Constraints

• club1, club2, and club3 each have between 1 and 50 elements, inclusive.
• Each element of club1, club2, and club3 contains between 1 and 50 characters, inclusive..
• Each element of club1, club2, and club3 consists only of uppercase letters ('A'-'Z').

### Examples

1. ```club1 = {"JOHN","JOHN","FRED","PEG"}

club2 = {"PEG","GEORGE"}

club3 = {"GEORGE","DAVID"}
```
Returns: { "GEORGE", "PEG" }

"PEG" went to club1 and club2, and "GEORGE" went to club2 and club3.

2. ```

club1 = {"DOUG","DOUG","DOUG","DOUG","DOUG"}

club2 = {"BOBBY","BOBBY"}

club3 = {"JAMES"}
```
Returns: { }

Here, no one went to more than one club location.

3. ```

club1 = {"BOBBY"}

club2 = {"BOB","BOBBY"}

club3 = {"BOB"}
```

Returns: { "BOB", "BOBBY" }

Note that "BOB" is sorted before "BOBBY"

4. ```club1 = {"BOBBY","HUGH","LIZ","GEORGE"}

club2 = {"ELIZABETH","WILL"}

club3 = {"BOB","BOBBY","BOBBY","PAM","LIZ","BOBBY","BOBBY","WILL"}
```

Returns: { "BOBBY", "LIZ", "WILL" }

5. ```
club1 = {"JAMES","HUGH","HUGH","GEORGE","ELIZABETH","ELIZABETH","HUGH",
"DAVID","ROBERT","DAVID","BOB","BOBBY","PAM","JAMES","JAMES"}

club2 = {"BOBBY","ROBERT","GEORGE","JAMES","PEG","JAMES","DAVID","JOHN","LIZ",
"SANDRA","GEORGE","JOHN","GEORGE","ELIZABETH","LIZ","JAMES"}

club3 = {"ROBERT","ROBERT","ROBERT","SANDRA","PAM","BOB","LIZ","GEORGE"}
```

Returns:

```{ "BOB",
"BOBBY",
"DAVID",
"ELIZABETH",
"GEORGE",
"JAMES",
"LIZ",
"PAM",
"ROBERT",
"SANDRA" }
```

6. ```
club1 = {"LIZ","WILL","JAMES"}

club2 = {"JOHN","ROBERT","GEORGE","LIZ","PEG","HUGH","BOB","BOBBY","ROBERT","ELIZABETH","DAVID"}

club3 = {"PAM","DAVID","SANDRA","GEORGE","JOHN","ROBERT","SANDRA","GEORGE"}
```

Returns: { "DAVID", "GEORGE", "JOHN", "LIZ", "ROBERT" }

7. ```

club1 = {"PEG","ROBERT","PAM","JOHN","DAVID","JOHN","ROBERT",
"GEORGE","HUGH","WILL","JAMES","JAMES","BOBBY","BOBBY","SANDRA"}

club2 = {"SANDRA","BOB","PAM","JAMES","WILL","DAVID","BOBBY","GEORGE",
"WILL","LIZ","BOBBY","ROBERT","WILL","BOB","BOBBY","ELIZABETH","HUGH"}

club3 = {"WILL","PEG","ELIZABETH","DAVID","HUGH","BOBBY","JOHN","SANDRA","ELIZABETH",
"ELIZABETH","SANDRA","GEORGE","PAM","ELIZABETH","BOBBY","DAVID","PAM"}
```

Returns:

```{ "BOBBY",
"DAVID",
"ELIZABETH",
"GEORGE",
"HUGH",
"JAMES",
"JOHN",
"PAM",
"PEG",
"ROBERT",
"SANDRA",
"WILL" }
```

8. ```club1 = {"AHHOZY","AHHAPLL","ASNV"}

club2 = {"AHDLTOE","AHUKPJ","AHDENCTPP","AHDENCJ","AHDLNZC","AHDLTOGG","AHHAPMBG",
"ALE","AHBHA","AHUKP","AHDQMILLP","AHDENEDY","AHDENEE","AHHOHVCX","AHISK",
"AHW","AQDB","AHUP","AQDBNPU","AGWZUV","AHHOSUW","AHXS","AHDENCP","AHDQM",
"AHDLTURV","AHBHVV","AHDQMILL","AHDQMD","AHH","AHDLTU","AHISFNO","AHURF",
"AH","AHHAPNQ","AQPL","AHDXL","AHDLTUGX","AHDLT","AHUKRC","AHDLTUGX",
"AQDTXYX","AGWZS"}

club3 = {"AHHAPMFF","AHURA","AHHOZ","AHISKH","AHUPR","AHHAPM","AHUKRHIN","AHHAP",
"AHDLTMO","AHDLTUJ","AHDQY","AHUK","AHDENEDY","AHWK","AHHOZGJJ","AHXS",
"AHDLTUREL","AHHOZQNL","AHHOSUWOS"}
```

Returns: { "AHDENEDY", "AHXS" }

Owen L. Astrachan