fork(2) download
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Test
  5. {
  6. static void Main(string[] args)
  7. {
  8. Console.WriteLine("Введи мне строку со словами..в любом регистре");
  9. string str = "ИНИМУМ МИНИМУМ".ToUpper();
  10. char[] separator = { ' ' };
  11. string[] strArr = str.Split(separator,StringSplitOptions.RemoveEmptyEntries);
  12. Console.WriteLine("Все слова из предложения");
  13. foreach (var val in strArr)
  14. {
  15. Console.WriteLine(val);
  16. str = str.Replace(val, val.First() + String.Join("", val.Skip(1).ToArray()).Replace(val.First(), '.'));
  17. }
  18. Console.WriteLine("Результат замены: \n{0}",str);
  19. Console.ReadKey();
  20. }
  21. }
Success #stdin #stdout 0s 29808KB
stdin
Standard input is empty
stdout
Введи мне строку со словами..в любом регистре
Все слова из предложения
ИНИМУМ
МИНИМУМ
Результат замены: 
ИН.МУМ  МИН.МУМ