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;
- namespace בגרות_2003_תרגיל_8
- {
- class Program
- {
- static void Main(string[] args)
- {
- string strBefore;
- string strAfter;
- int count = 1;
- char ch;
- string strCh;
- Console.WriteLine("Input a phrase no longer than 120 characters:");
- strBefore = Console.ReadLine();
- strAfter = strBefore;
- for (int i = 0; i < strBefore.Length - 1; i++)
- {
- if (strBefore[i] < 'M' && strBefore[i] >= 'A')
- {
- ch = strBefore[i];
- ch++;
- strCh = ch.ToString();
- strAfter = strAfter.Insert(i + count, strCh);
- count++;
- }
- else if (strBefore[i] >= 'M' && strBefore[i] <= 'Z')
- {
- ch = strBefore[i];
- ch--;
- strCh = ch.ToString();
- strAfter = strAfter.Insert(i + count, strCh);
- count++;
- }
- else if (strBefore[i] == ' ')
- {
- strAfter = strAfter.Replace(" ", "");
- }
- }
- Console.WriteLine();
- Console.WriteLine(strAfter);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement