Skip to content

Commit

Permalink
PKU
Browse files Browse the repository at this point in the history
  • Loading branch information
marioyc committed Jan 29, 2011
1 parent 01e9265 commit 7b6d57b
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions PKU/2945 - Find the Clones.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>

using namespace std;

int main(){
int n,m,cont[20000];
char s[21];
string a[20000];

while(true){
scanf("%d %d",&n,&m);
if(n==0) break;

for(int i = 0;i<n;++i){
scanf("%s",s);
a[i] = string(s);
}

memset(cont,0,sizeof(cont));
sort(a,a+n);

int s = 0,e;

while(s<n){
e = s+1;
while(e<n && a[e]==a[s]) ++e;
++cont[e-s-1];
s = e;
}

for(int i = 0;i<n;++i) printf("%d\n",cont[i]);
}

return 0;
}

0 comments on commit 7b6d57b

Please sign in to comment.