Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Piglatin
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input;
- while ((input = Console.ReadLine()) != null)
- {
- string output = "";
- string[] words = input.Split(' ');
- foreach (string word in words)
- {
- if (word[0] == 'a' || word[0] == 'e' || word[0] == 'i' || word[0] == 'o' || word[0] == 'u' || word[0] == 'y')
- {
- string sub = word;
- sub = sub + "yay";
- output = output + sub + " ";
- }
- else
- {
- for (int i = 0; i < word.Length; i++)
- {
- string elsesub;
- string newsub;
- if (word[i] == 'a' || word[i] == 'e' || word[i] == 'i' || word[i] == 'o' || word[i] == 'u' || word[i] == 'y')
- {
- elsesub = word.Substring(0, i);
- newsub = word.Substring(i) + elsesub + "ay";
- output = output + newsub + " ";
- break;
- }
- }
- }
- }
- Console.WriteLine(output);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement