Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Linq;
- namespace ACMPC
- {
- class Program
- {
- static void Main(string[] args)
- {
- try {
- FilterFile(args.Length>0?new StreamReader(args[0]):Console.In,
- args.Length>1?new StreamWriter(args[1]):Console.Out);
- } catch(IOException e)
- {
- Console.Error.WriteLine("IO error encountered: {0}", e.Message);
- }
- }
- static readonly string validChars = "abcdefghijklmnopqrstuvwxyz ";
- static void FilterFile(TextReader input, TextWriter output)
- {
- string val = null;
- while ((val = input.ReadLine().ToLower()) != "end")
- if (!val.Any(x => !validChars.Contains(x)||
- (x!=' ' && val.Where(y => y == x).Count() > 1)))
- output.WriteLine(val);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement