Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace PMPHF004_P99J7Y
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- string E = Console.ReadLine();
- char[] chararray = E.ToCharArray();
- #region 1. lépés
- if (E.Length > 1)
- {
- string elsolep = "";
- for (int i = 1; i < chararray.Length; i += 2)
- {
- elsolep += chararray[i];
- }
- int hossz = elsolep.Length - 1;
- string megfordit = "";
- while (hossz >= 0)
- {
- megfordit += elsolep[hossz];
- hossz--;
- }
- char[] elsoarray = megfordit.ToCharArray();
- int n1 = 0;
- for (int i = 0; i < chararray.Length; ++i)
- {
- if (i % 2 == 1)
- {
- chararray[i] = elsoarray[n1];
- n1++;
- }
- }
- }
- #endregion 1. lépés
- #region 2. lépés
- if (E.Length > 2)
- {
- string masodik = "";
- for (int i = 2; i < chararray.Length; i += 3)
- {
- masodik += chararray[i];
- }
- char firstchar = masodik[0];
- for (int i = 5; i < chararray.Length; i += 3)
- {
- chararray[i - 3] = chararray[i];
- }
- int index = chararray.Length;
- if (chararray.Length % 3 == 0)
- {
- index = chararray.Length - 1;
- }
- else if (chararray.Length % 3 == 2)
- {
- index = chararray.Length - 3;
- }
- else
- {
- index = chararray.Length - 2;
- }
- chararray[index] = firstchar;
- }
- #endregion 2. lépés
- #region 3. lépés
- if (E.Length > 3)
- {
- string harmadik = "";
- for (int i = 3; i < chararray.Length; i += 4)
- {
- harmadik += chararray[i];
- }
- chararray[3] = harmadik[harmadik.Length - 1];
- int k = 0;
- for (int i = 7; i < chararray.Length; i += 4)
- {
- chararray[i] = harmadik[k];
- k++;
- }
- }
- #endregion 3. lépés
- Console.Clear();
- #region 4. lépés
- string szo = new string(chararray);
- string[] szavak = szo.Split(' ');
- int[] count = new int[szavak.Length];
- for (int i = 0; i < szavak.Length; i++)
- {
- count[i] = szavak[i].Length;
- }
- int length = count.Length-1;
- string reverse = "";
- while (length >= 0)
- {
- reverse += count[length]+" ";
- length--;
- }
- for (int i = 0; i < count.Length; i++)
- {
- count[i] = int.Parse(reverse.Split(" ")[i]);
- }
- if (chararray.Length > 1)
- {
- string megoldas = "";
- for (int i = 0; i < szavak.Length; i++)
- {
- megoldas += szavak[i];
- }
- int f = 0;
- for (int i = 0; i < szavak.Length; i++)
- {
- megoldas = megoldas.Insert(count[i] + f, " ");
- f += count[i]+1;
- }
- Console.Write(megoldas.Remove(megoldas.Length - 1));
- }
- else
- {
- Console.Write(chararray);
- }
- #endregion 4. lépés
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement