Advertisement
viraco4a

05. Word in Plural

May 22nd, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _05_wordInPlural
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string word = Console.ReadLine().ToLower();
  10. int wordLenght = word.Length;
  11. bool endsInY = word.EndsWith("y");
  12. bool endsInOtoH = word.EndsWith("o") || word.EndsWith("ch") || word.EndsWith("s") || word.EndsWith("sh")
  13. || word.EndsWith("x") || word.EndsWith("z") || word.EndsWith("h");
  14.  
  15. if (endsInY)
  16. {
  17. word = word.Remove(wordLenght - 1, 1);
  18. word = word + "ies";
  19. }
  20. else if (endsInOtoH)
  21. {
  22. word = word + "es";
  23. }
  24. else
  25. {
  26. word = word + "s";
  27. }
  28. Console.WriteLine(word);
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement