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;
- public class Program
- {
- public static void Main()
- {
- string input = Console.ReadLine();
- var firstPart = input.IndexOf("://");
- if (firstPart>0)
- {
- string protocol = input.Substring(0, firstPart);
- if (input.Substring(firstPart+3).Contains("/"))
- {
- var secondPart = input.IndexOf("/", firstPart+3);
- string server = input.Substring(firstPart+3, secondPart-firstPart-3);
- string resourse = input.Substring(secondPart+1);
- Console.WriteLine("[protocol] = \"{0}\"", protocol);
- Console.WriteLine("[server] = \"{0}\"", server);
- Console.WriteLine("[resource] = \"{0}\"", resourse);
- }
- else
- {
- string server = input.Substring(firstPart+3);
- Console.WriteLine("[protocol] = \"{0}\"", protocol);
- Console.WriteLine("[server] = \"{0}\"", server);
- Console.WriteLine("[resource] = \"\"");
- }
- }
- else if (firstPart <=0)
- {
- string server = input.Substring(0);
- Console.WriteLine("[protocol] = \"\"");
- Console.WriteLine("[server] = \"{0}\"", server);
- Console.WriteLine("[resource] = \"\"");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement