String ss = "lijo is lijom is lijo fdf"; //here two words "is" and "lijo" is repeating two times so my output will be
output : lijo
is
I tried Like this
var count=words.GroupBy(g=>g).Max(k=>k.Count());
//finding the max repeating elements count =2
var res = words.GroupBy(s => s).Where(g => g.Count() == count).Select(s => s);
here i have tried by first finding the max count of repeating words. and assign this value in another query.
i need to know if we can write both this queries together as one query. as a subquery how to do this in a different way ? using subquery or any other easy method?