Advertisement
Guest User

Untitled

a guest
May 24th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. using System;
  2. using System.Text;
  3. using System.IO;
  4.  
  5. namespace ConsoleApp1
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. string path = @"d:\e4.txt";
  12. if (File.Exists(path))
  13. {
  14. StringBuilder input = new StringBuilder(File.ReadAllText(path));
  15. StringBuilder ech = new StringBuilder("эчпочмак");
  16. int[] count = new int[8];
  17. for (int i = 0; i < 8; i++)
  18. {
  19. for (int j = 0; j < input.Length; j++)
  20. {
  21. if (input[j] == ech[i])
  22. {
  23. count[i]++;
  24. }
  25. }
  26. }
  27.  
  28. int min = count[0];
  29. for (int k = 0; k < 8; k++)
  30. {
  31. if (count[k] < min)
  32. min = count[k];
  33. }
  34. Console.WriteLine("Количество эчпочмаков:");
  35. Console.WriteLine(min);
  36. Console.ReadLine();
  37. }
  38. else Console.WriteLine("Файл не найден");
  39. Console.ReadLine();
  40.  
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement