String operation find letter in a word that are repeating

I want to extract repeating letters from word.
For example

Input - madam
Output - ma

Input - teacher
Output - e

Please help

Hi @ravig1206,

Try this, split the word into characters and then do a count of all the char extracted.
If the count is coming up >1 then that means it’s repeating char

Thanks,
Shubham

@ravig1206
We can count the repeating chars by following:

grafik

we did an uppercase, just for egalizing the chars for being case insensitive

with a split mentioned by @Shubham_Varshney you are prepared to handle multiple words if it is needed. For this also we would suggest to adopt the flow and let produce a report table e.g. with following cols:
Word, RepeatedChars
Madam, MA

4 Likes

Hi @ravig1206 ,
Here is a Lambda Expression of the solution.

String.Join(String.Empty,(“Madam”).ToLower.ToCharArray.GroupBy(Function(g) g).Where(Function(s) s.Count>1).Select(Function(s)s.First))

Kind Regards,
Ashwin A.K

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.