BubaLazi

LambdaLinq 01 proba

Aug 9th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace MultiDictionaries
  8. {
  9.     class Program
  10.     {
  11.         static void Main()
  12.         {
  13.             Dictionary<string, string> storePairs = new Dictionary<string, string>();
  14.             string[] words = Console.ReadLine().Split(new char[] { ' ', '->' }, StringSplitOptions.RemoveEmptyEntries);
  15.          
  16.             while(words[0] != "end")
  17.             {
  18.                 string keyInput = words[0];
  19.                 string valueInput = words[1];
  20.                 storePairs.Add(keyInput, valueInput);
  21.             }
  22.  
  23.             string nullWord = "null";
  24.             string defaultWord = Console.ReadLine();
  25.  
  26.             foreach (KeyValuePair<string, string> pair in storePairs)
  27.             {
  28.                 if (storePairs.ContainsValue(nullWord))
  29.                 {
  30.                     storePairs[pair.Key] = defaultWord;
  31.                 }
  32.             }
  33.            
  34.             foreach()            
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment