Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uprajnenie v chas ///////////////
- string banList = Console.ReadLine();
- string[] parts = Console.ReadLine().Split(new[] { '@' });
- string username = parts[0]; // "hello"
- string domain = parts[1]; // "example.com"
- string replace = new string('*', username.Length);
- banList = banList.Replace(username, replace);
- Console.WriteLine(banList);
- 1 zadacha ///////////////////////////////////////////////////////////////////
- string text = "Elrond: Cast it into the fire! Destroy it!";
- char[] charr = text.ToCharArray();
- Array.Reverse(charr);
- Console.WriteLine(charr);
- 2 zadacha ///////////////////////////////////////////////////////////////////////
- Console.Write("Enter a sequence of characters with max lenght 20: ");
- string text = Console.ReadLine();
- string result = text;
- if (text.Length <= 20)
- {
- text = text.PadRight(20, '*');
- Console.WriteLine(text);
- }
- else
- {
- result = text.Substring(0, 20);
- Console.WriteLine(result);
- }
- 3 zadacha ///////////////////////////////////////////////////////////////////////////////
- string text = Console.ReadLine().ToLower();
- string search = Console.ReadLine().ToLower();
- int count = text.Select((c, i) => text.Substring(i)).Count(sub => sub.StartsWith(search));
- Console.WriteLine(count);
- 4 zadacha ////////////////////////////////////////////////////////////////////////////
- string[] banList = Console.ReadLine().Split(',').Select(b => b.Trim()).ToArray();
- string text = Console.ReadLine();
- foreach (var ban in banList)
- {
- string replace = new string('*', ban.Length);
- text = text.Replace(ban, replace);
- }
- Console.WriteLine(text);
- 5 zadacha /////////////////////////////////////////////////////////////////
- string input = Console.ReadLine();
- foreach (var ch in input)
- {
- int num = Convert.ToInt32(ch);
- Console.Write("\\u{0:x4}", num);
- }
- Console.WriteLine();
- 6 zadacha //////////////////////////////////////////////////////////////////////
- char[] symbols = { ',', '?', '!', '.', ' ' };
- List<string> words = Console.ReadLine().Split(symbols, StringSplitOptions.RemoveEmptyEntries).Select(p => p).ToList();
- var result = new SortedSet<string>();
- bool isPalimandor = true;
- foreach (string word in words)
- {
- isPalimandor = true;
- if (word.Length == 1)
- {
- result.Add(word);
- }
- ///////////////////////
- for (int i = 0; i < word.Length / 2; i++)
- {
- if (word[i] != word[word.Length - i - 1])
- {
- isPalimandor = false;
- }
- if (isPalimandor == true)
- {
- result.Add(word);
- }
- }
- }
- Console.WriteLine(string.Join(", ", result));
- 7 zadacha /////////////////////////////////////////////////////////////////////////////////////
- Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
- string[] input = Console.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).ToArray();
- double sum = 0;
- for (int i = 0; i < input.Length; i++)
- {
- string fromInput = input[i];
- char before = fromInput[0];
- char after = fromInput[fromInput.Length - 1];
- double num = double.Parse(fromInput.Substring(1, fromInput.Length - 2));
- if (char.IsUpper(before))
- {
- int beforePossition = before - 'A' + 1;
- num /= beforePossition;
- }
- else
- {
- int beforePossition = before - 'a' + 1;
- num *= beforePossition;
- }
- if (char.IsUpper(after))
- {
- int afrerPossition = after - 'A' + 1;
- num -= afrerPossition;
- }
- else
- {
- int afrerPossition = after - 'a' + 1;
- num += afrerPossition;
- }
- sum += num;
- }
- Console.WriteLine("{0:f2}", sum);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement