Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Text;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- namespace ConsoleApp3
- {
- class Program4
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Please enter the symbol - ");
- char sym = char.Parse(Console.ReadLine());
- using (StreamReader fileIn = new StreamReader("C:/Users/belousaa/Documents/Visual Studio 2017/pract8.txt", Encoding.GetEncoding(1251)))
- {
- using (StreamWriter fileOut = new StreamWriter("C:/Users/belousaa/Documents/Visual Studio 2017/out.txt", false))
- {
- string[] words = fileIn.ReadToEnd().Split(new char[] { ' ', '!', '.', ',', '?', '-', ':' }, StringSplitOptions.RemoveEmptyEntries);
- foreach (var word in words)
- {
- if (word[word.Length-1] != sym)
- {
- fileOut.Write(word + " ");
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement