Advertisement
myname0

Практикум8_I_4

Oct 22nd, 2015
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1.         static void Main(string[] args)
  2.         {
  3.             Console.Write("Enter string: ");
  4.             string str = Console.ReadLine();
  5.             char [] mas = new char [str.Length];
  6.             int count;
  7.             bool flag = true;
  8.             Console.WriteLine("Символы, встречающиеся в строке один раз:");
  9.             for(int i = 0; i < str.Length; i++)
  10.             {
  11.                 count = 0;
  12.                 for (int j = 0; j < str.Length; j++)
  13.                 {
  14.                     if (str[i] == str[j])
  15.                     {
  16.                         count++;
  17.                     }
  18.                 }
  19.                 if (count == 1)
  20.                 {
  21.                     flag = false;
  22.                     Console.Write(str[i]);
  23.                 }
  24.                    
  25.             }
  26.             if (flag) Console.Write("В строке нет символов, повторяющихся один раз.");
  27.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement