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.Text.RegularExpressions;
- class PHP
- {
- static void Main()
- {
- string line = string.Empty;
- string currLine = Console.ReadLine();
- StringBuilder fullLine = new StringBuilder();
- while(currLine != "?>")
- {
- currLine = Regex.Replace(Console.ReadLine(), @"(//|#).*", "");
- fullLine.AppendLine(currLine);
- }
- line = fullLine.ToString();
- line = Regex.Replace(line, @"(/\*).*?(\*/)", "");
- HashSet<string> results = new HashSet<string>();
- Match variable = Regex.Match(line, @"([^\\])\$([a-zA-Z_](\w*)?)");
- while (variable.Success)
- {
- results.Add(variable.Groups[2].Value);
- variable = variable.NextMatch();
- }
- string[] print = new string[results.Count];
- for (int i = 0; i < results.Count; i++) print[i] = results.ElementAt(i);
- Printing (print);
- }
- static void Printing(string[] print)
- {
- Array.Sort<string>(print);
- Console.WriteLine(print.Length);
- List<string> notUpper = new List<string>();
- for(int i = 0; i < print.Length; i++)
- {
- if(!char.IsUpper(print[i][0]))
- {
- notUpper.Add(print[i]);
- continue;
- }
- Console.WriteLine(print[i]);
- }
- for (int i = 0; i < notUpper.Count; i++)
- {
- Console.WriteLine(notUpper[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement