added counting sort and find first non-repeated char