Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. using System;
  2. using System.Text.RegularExpressions;
  3. public class Kata
  4. {
  5. public static int DuplicateCount(string str)
  6. {
  7. str = str.ToLower();
  8. str = str.Replace(" ", "");
  9. int x = 0;
  10. for (int i = 0; i < str.Length; i++){
  11.  
  12. for (int m = 0; m < str.Length; m++){
  13.  
  14. if(str[m] == str[i] && m != i){
  15. x++;
  16. str = str.Replace(str[i].ToString(), "");
  17. }
  18.  
  19. }
  20.  
  21. }
  22. return x;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement