DEV Community

Discussion on: Daily Challenge #66- Friend List

Collapse
 
peledzohar profile image
Zohar Peled

Not much of a challenge, I'm afraid. Pretty straight forward split, split, join, sort and join again. A one liner in most modern languages, I suspect.
In c# it would look like this:

string meeting(string s)
{
    return "(" + string.Join(")(", 
        s.
        ToUpper().
        Split(';').
        Select(n => n.Split(':')).
        Select(n => string.Join(":", n.Reverse())).
        OrderBy(n => n)
    ) + ")"; 
}