Easy and simple c++ code


#1

int n = a.size();
int c0=0,c1=0,c2=0;
for(int j = 0; j < n; j++){
if(a[j] == 0){
c0++;
}
else if(a[j] == 1){
c1++;
}
else{
c2++;
}

}
int l =0;
for(int k = 0; k < c0; k++){
	a[l++] = 0; 
}
for(int k = 0; k < c1; k++){
	a[l++] = 1; 
}
for(int k = 0; k < c2; k++){
	a[l++] = 2; 
}