Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Pluralizer
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string noun = Console.ReadLine();
  10.             if(noun.EndsWith('y'))
  11.             {
  12.                 noun = noun.Remove(noun.LastIndexOf('y'));
  13.                 noun = noun.Insert(noun.Length, "ies");
  14.             }
  15.             else if(noun.EndsWith('o')||noun.EndsWith("ch")||noun.EndsWith("sh")||noun.EndsWith('x')||noun.EndsWith('z'))
  16.             {
  17.                 noun = noun.Insert(noun.Length, "es");
  18.             }
  19.             else
  20.             {
  21.                 noun = noun.Insert(noun.Length, "s");
  22.             }
  23.             Console.WriteLine(noun);
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement