Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Zad
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine($"Результат: {FindSymboleOnce(Console.ReadLine(), 'b')}");
- }
- private static bool FindSymboleOnce(string text, char needSymbol)
- {
- int countFound = 0;
- foreach (char sybmol in text)
- {
- if (sybmol == needSymbol)
- countFound++;
- if (countFound > 1)
- return false;
- }
- if (countFound == 0)
- return false;
- else
- return true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment