fork(3) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4.  
  5.  
  6. namespace Spacje
  7. {
  8. class Program
  9. {
  10.  
  11. static void Main(string[] args)
  12. {
  13. List<string> converted = new List<string>();
  14. var text = Console.ReadLine();
  15.  
  16. while (!String.IsNullOrEmpty(text))
  17. {
  18.  
  19. TextInfo ti = CultureInfo.CurrentCulture.TextInfo;
  20. if (char.IsWhiteSpace(text[0]))
  21. {
  22. string convertedText = ti.ToTitleCase(text).Replace(" ","");
  23. converted.Add(convertedText);
  24. }
  25. else
  26. {
  27. var rozdzielone = text.Split(' ');
  28. var pierwszeSlowo = rozdzielone[0];
  29. var pierwszeSlowo2="";
  30. if (char.IsLower(pierwszeSlowo[0]))
  31. {
  32. pierwszeSlowo2 = ti.ToLower(pierwszeSlowo);
  33. }
  34. else
  35. {
  36. pierwszeSlowo2 = ti.ToTitleCase(pierwszeSlowo);
  37. }
  38. string convertedText = "";
  39. for (int i = 1; i < rozdzielone.Length; i++)
  40. {
  41.  
  42. convertedText += ti.ToTitleCase(rozdzielone[i]);
  43.  
  44. }
  45. string noweZdanie = pierwszeSlowo2 + convertedText;
  46. converted.Add(noweZdanie);
  47. }
  48. text = Console.ReadLine();
  49. }
  50. foreach (string texts in converted)
  51. {
  52. Console.WriteLine(texts);
  53. }
  54. }
  55. }
  56. }
Success #stdin #stdout 0s 29664KB
stdin
ala ma KoTa,
Ola ma pSa.
 ala ma KoTa,
 Ola ma pSa.
stdout
alaMaKota,
OlaMaPsa.
AlaMaKota,
OlaMaPsa.