Advertisement
bacco

Word in Plural ( Length )

May 15th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. using System;
  2.  
  3. namespace gr
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             var singleWord = Console.ReadLine();
  10.  
  11.             char last  = singleWord[singleWord.Length - 1];
  12.             char first = singleWord[singleWord.Length - 2];
  13.  
  14.             if (last == 'y')
  15.             {
  16.                 singleWord = singleWord.Remove(singleWord.Length - 1);
  17.                 Console.WriteLine(singleWord + "ies");
  18.             }
  19.  
  20.             else if (last == 'o' ||
  21.                      last == 's' ||
  22.                      last == 'x' ||
  23.                      last == 'z' ||
  24.                             (first == 'c' && last == 'h'||
  25.                              first == 's' && last == 'h'))
  26.             {
  27.                 Console.WriteLine(singleWord + "es");
  28.             }
  29.  
  30.             else
  31.             {
  32.                 Console.WriteLine(singleWord + 's');
  33.             }
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement