Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 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 Piglatin
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string input;
  14.  
  15.  
  16. while ((input = Console.ReadLine()) != null)
  17. {
  18. string output = "";
  19. string[] words = input.Split(' ');
  20.  
  21. foreach (string word in words)
  22. {
  23. if (word[0] == 'a' || word[0] == 'e' || word[0] == 'i' || word[0] == 'o' || word[0] == 'u' || word[0] == 'y')
  24. {
  25. string sub = word;
  26. sub = sub + "yay";
  27. output = output + sub + " ";
  28. }
  29. else
  30. {
  31. for (int i = 0; i < word.Length; i++)
  32. {
  33. string elsesub;
  34. string newsub;
  35. if (word[i] == 'a' || word[i] == 'e' || word[i] == 'i' || word[i] == 'o' || word[i] == 'u' || word[i] == 'y')
  36. {
  37. elsesub = word.Substring(0, i);
  38. newsub = word.Substring(i) + elsesub + "ay";
  39. output = output + newsub + " ";
  40. break;
  41. }
  42. }
  43. }
  44. }
  45. Console.WriteLine(output);
  46. }
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement