Advertisement
rdsedmundo

ali...cpp

May 16th, 2014
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <string>
  3. #include <algorithm>
  4. #include <iostream>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9.  
  10.     while(1) {
  11.         int n, count = 0, i, j;
  12.         cin >> n;
  13.  
  14.         if(!n)
  15.             break;
  16.  
  17.         string dna[n];
  18.  
  19.         for(i = 0; i < n; i++) {
  20.             cin >> dna[i];
  21.             sort(dna[i].begin(), dna[i].end());
  22.  
  23.             for(j = 0; j < i; j++)
  24.                 if(dna[i] != dna[j])
  25.                     count++;
  26.         }
  27.  
  28.         cout << count << endl;
  29.     }
  30.  
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement