Advertisement
YavorGrancharov

Word_in_Plural

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