Advertisement
tochka

Word in Plural

Sep 21st, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 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 ConsoleApp72
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string word = Console.ReadLine();
  14.  
  15.  
  16.             if (word.EndsWith("y"))
  17.             {
  18.                 word = word.Substring(0, word.Length - 1);
  19.                 word.Remove(word.Length - 1, 1);
  20.                 word = word + "ies";
  21.                 Console.WriteLine(word);
  22.  
  23.             }
  24.             else if (word.EndsWith("o") || word.EndsWith("ch") || word.EndsWith("s") || word.EndsWith("sh") || word.EndsWith("z")
  25.                 || word.EndsWith("x"))
  26.             {
  27.                 word.Remove(word.Length - 1, 1);
  28.                 word = word + "es";
  29.                 Console.WriteLine(word);
  30.             }
  31.             else
  32.             {
  33.                 word.Remove(word.Length - 1, 1);
  34.                 word = word + "s";
  35.                 Console.WriteLine(word);
  36.             }
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement