Advertisement
Radostta

Word In Plural

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