|  | 
|  | 
| back to board | AC C++ #include <iostream>#include <string>
 #include <ctime>
 #include <cstdlib>
 using namespace std;
 int main(){
 int n, active, s = 0;
 bool kek = true;
 cin >> n;
 string *str = new string[n];
 for (int i = 0; i < n; i++)
 {
 cin >> str[i];
 }
 for (int i = 0; i < n; i++)
 {
 for (int j = 0; j < n; j++)
 {
 if (str[i] == str[j] && i != j){
 str[j] = "1";
 s = 1;
 }
 
 }
 if (s == 1 && str[i]!="1"){
 cout << str[i] << endl;
 }
 
 str[i] = "1";
 s = 0;
 
 
 
 }
 }
 
 If you can't solve this solution, it may help you.
 | 
 | 
|