the problem is that i can't get all the common ellements into another char[]
Example:
c1:abbc
=========>c3:aaabbbbcc this is what i'm having problems getting.
c2:bbbcdaa
even if i sort first the 2 strings :
c1:abbc
c2:aabbbcd
I can't just comare the 2 and put them in c3. For example the first 'a' would be put in twice !!!!
I thaught about reducing the strings:
s1:abc
s2:abcd
Then compare c1 with s2 and c2 with s1 --> then put what's commone from each in c3 ... after that it would be simple.
private static int removeExtra(char a[]){
int i;
int d=a.length;
for(i=0;i<a.length-1;i++){
if(a[i]==a[i+1]){
a[i]=a[i+1];
d--;
}
}
}
that's how i'm thinking of doing it. but i have to return th letters that remain .. and not sure how to do it...... and what to write in main.
Hmmmmmm.......... <_<