Start here:
 DataInputStream in=new DataInputStream(System.in); 
You should not use DataInputStream ... and I see that you already have explanations about this.
But besides this:
 for(int e=0; e<a; e++) 
You immediately hit num [d] and num [e] equal. Since your second loop actually compares num [0] with num [0], for example. So: the second cycle should only work on indices after the external!
In addition, it is also unclear whether you want to โduplicateโ 50 times if you entered a 50-fold number. I would rather go and print the number of duplicates for the number.
In other words: after fixing the problem with the input stream, your code will still not do the right thing.
And besides: using single-character names makes it almost impossible to easily understand what this code does.
 source share