Advertisement
Guest User

Untitled

a guest
May 25th, 2017
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 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 _05.Word_in_Plural
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string word = Console.ReadLine();
  14.  
  15. bool lastLetterY = word.EndsWith("y");
  16. bool lastLetterZ = word.EndsWith("z");
  17. bool lastLetterO = word.EndsWith("o");
  18. bool lastLetterCH = word.EndsWith("ch");
  19. bool lastLetterS = word.EndsWith("s");
  20. bool lastLetterSH = word.EndsWith("sh");
  21. bool lastLetterX = word.EndsWith("x");
  22.  
  23. if (lastLetterY)
  24. {
  25. int remove = word.IndexOf("y");
  26. word = word.Replace("y", "ies");
  27. }
  28. else if (lastLetterO)
  29. {
  30. int remove = word.IndexOf("o");
  31. word = word.Replace("o", "oes");
  32. }
  33. else if (lastLetterZ)
  34. {
  35. int remove = word.IndexOf("z");
  36. word = word.Replace("z", "zes");
  37. }
  38. else if (lastLetterCH)
  39. {
  40. int remove = word.IndexOf("ch");
  41. word = word.Replace("ch", "ches");
  42. }
  43. else if (lastLetterS)
  44. {
  45. int remove = word.IndexOf("s");
  46. word = word.Replace("s", "ses");
  47. }
  48. else if (lastLetterSH)
  49. {
  50. int remove = word.IndexOf("sh");
  51. word = word.Replace("sh", "shes");
  52. }
  53. else if (lastLetterX)
  54. {
  55. int remove = word.IndexOf("x");
  56. word = word.Replace("x", "xes");
  57. }
  58. else
  59. {
  60. word += "s";
  61. }
  62.  
  63. Console.WriteLine(word);
  64. }
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement