Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- public class Program
- {
- public static void Main()
- {
- string input = Console.ReadLine();
- List<string> inputs = input.Split(' ').ToList();
- List<string> orderedInput = new List<string>();
- if (inputs[0].Contains("x^2"))
- {
- if(inputs[0][0] == '-')
- {
- orderedInput.Add("-");
- inputs[0] = inputs[0].Replace("-", "");
- }
- else
- {
- orderedInput.Add("+");
- }
- orderedInput.Add(inputs[0]);
- }
- else if (inputs[2].Contains("x^2"))
- {
- orderedInput.Add(inputs[1]);
- orderedInput.Add(inputs[2]);
- }
- else if (inputs[4].Contains("x^2"))
- {
- orderedInput.Add(inputs[3]);
- orderedInput.Add(inputs[4]);
- }
- if (inputs[0].Contains("x") && !inputs[0].Contains("x^2"))
- {
- Console.WriteLine("ddz");
- if (inputs[0][0] == '-')
- {
- orderedInput.Add("-");
- inputs[0] = inputs[0].Replace("-", "");
- }
- else
- {
- orderedInput.Add("+");
- }
- orderedInput.Add(inputs[0]);
- }
- else if (inputs[2].Contains("x") && !inputs[0].Contains("x^2"))
- {
- Console.WriteLine("ddz");
- orderedInput.Add(inputs[1]);
- orderedInput.Add(inputs[2]);
- }
- else if (inputs[4].Contains("x") && inputs[0].Contains("x^2") == false)
- {
- Console.WriteLine("ddz");
- orderedInput.Add(inputs[3]);
- orderedInput.Add(inputs[4]);
- }
- if (int.TryParse(inputs[0], out int result0) == true)
- {
- if (inputs[0][0] == '-')
- {
- orderedInput.Add("-");
- inputs[0] = inputs[0].Replace("-", "");
- }
- else
- {
- orderedInput.Add("+");
- }
- orderedInput.Add(inputs[0]);
- }
- else if (int.TryParse(inputs[2], out int result2) == true)
- {
- orderedInput.Add(inputs[1]);
- orderedInput.Add(inputs[2]);
- }
- else if(int.TryParse(inputs[4], out int result4) == true)
- {
- orderedInput.Add(inputs[3]);
- orderedInput.Add(inputs[4]);
- }
- //Console.WriteLine(orderedInput[0] + " " + orderedInput[1] + " " + orderedInput[2] + " " + orderedInput[3] + " " + orderedInput[4] + " " + orderedInput[5]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement