SHARE
TWEET

Untitled

a guest May 16th, 2018 193 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top