Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace StringConcatenation
- {
- class Program
- {
- static void Main()
- {
- char delimeter = char.Parse(Console.ReadLine());
- string evenOrOdd = Console.ReadLine();
- int n = int.Parse(Console.ReadLine());
- string sentence = null;
- for (int i = 1; i <= n; i++)
- {
- string word = Console.ReadLine();
- if (evenOrOdd == "odd")
- {
- if (i % 2 != 0)
- {
- sentence = sentence + word + delimeter;
- }
- }
- else
- {
- if (i % 2 == 0)
- {
- sentence = sentence + word + delimeter;
- }
- }
- }
- if (sentence.EndsWith(delimeter))
- {
- sentence = sentence.Remove(sentence.Length - 1);
- Console.WriteLine(sentence);
- }
- else
- {
- Console.WriteLine(sentence);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment