Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 404 bytes: using System;using System.Text;using System.Text.RegularExpressions;class j{static bool v(char l){return l=='e'||l=='a'||l=='o'||l=='i'||l=='u';}static void Main(){string a=Console.ReadLine();string z=Regex.Replace(a,"[^a-zA-Z ]","");string[]b=z.Split(' ');string c="";foreach(string d in b) {if(d.Length>4){foreach(char e in d.ToCharArray()){if(!v(e))c+=e;}}else{c+=d;}c+=' ';}Console.WriteLine(c);}}
- Fix to allow digits:
- 407 bytes: using System;using System.Text;using System.Text.RegularExpressions;class j{static bool v(char l){return l=='e'||l=='a'||l=='o'||l=='i'||l=='u';}static void Main(){string a=Console.ReadLine();string z=Regex.Replace(a,"[^a-zA-Z0-9 ]","");string[]b=z.Split(' ');string c="";foreach(string d in b) {if(d.Length>4){foreach(char e in d.ToCharArray()){if(!v(e))c+=e;}}else{c+=d;}c+=' ';}Console.WriteLine(c);}}
- Improve vowel checking:
- 398 bytes: using System;using System.Text;using System.Text.RegularExpressions;class j{static bool v(char l){return"aeiou".Contains(l.ToString());}static void Main(){string a=Console.ReadLine();string z=Regex.Replace(a,"[^a-zA-Z0-9 ]","");string[]b=z.Split(' ');string c="";foreach(string d in b) {if(d.Length>4){foreach(char e in d.ToCharArray()){if(!v(e))c+=e;}}else{c+=d;}c+=' ';}Console.WriteLine(c);}}
- Remove unnecessary whitespace:
- 394 bytes: using System;using System.Text;using System.Text.RegularExpressions;class j{static bool v(char l){return"aeiou".Contains(l.ToString());}static void Main(){string a=Console.ReadLine();string z=Regex.Replace(a,"[^a-zA-Z0-9 ]","");string[]b=z.Split(' ');string c="";foreach(string d in b){if(d.Length>4){foreach(char e in d.ToCharArray()){if(!v(e))c+=e;}}else{c+=d;}c+=' ';}Console.WriteLine(c);}}
- Create alias for Console:
- 392 bytes: using C=System.Console;using System.Text;using System.Text.RegularExpressions;class j{static bool v(char l){return"aeiou".Contains(l.ToString());}static void Main(){string a=C.ReadLine();string z=Regex.Replace(a,"[^a-zA-Z0-9 ]","");string[]b=z.Split(' ');string c="";foreach(string d in b){if(d.Length>4){foreach(char e in d.ToCharArray()){if(!v(e))c+=e;}}else{c+=d;}c+=' ';}C.WriteLine(c);}}
- Remove unused reference:
- 374 bytes: using C=System.Console;using System.Text.RegularExpressions;class j{static bool v(char l){return"aeiou".Contains(l.ToString());}static void Main(){string a=C.ReadLine();string z=Regex.Replace(a,"[^a-zA-Z0-9 ]","");string[]b=z.Split(' ');string c="";foreach(string d in b){if(d.Length>4){foreach(char e in d.ToCharArray()){if(!v(e))c+=e;}}else{c+=d;}c+=' ';}C.WriteLine(c);}}
- Use manual namespace declaration:
- 368 bytes: using C=System.Console;class j{static bool v(char l){return"aeiou".Contains(l.ToString());}static void Main(){string a=C.ReadLine();string z=System.Text.RegularExpressions.Regex.Replace(a,"[^a-zA-Z0-9 ]","");string[]b=z.Split(' ');string c="";foreach(string d in b){if(d.Length>4){foreach(char e in d.ToCharArray()){if(!v(e))c+=e;}}else{c+=d;}c+=' ';}C.WriteLine(c);}}
- Remove and substitute z:
- 357 bytes: using C=System.Console;class j{static bool v(char l){return"aeiou".Contains(l.ToString());}static void Main(){string a=C.ReadLine();string[]b=System.Text.RegularExpressions.Regex.Replace(a,"[^a-zA-Z0-9 ]","").Split(' ');string c="";foreach(string d in b){if(d.Length>4){foreach(char e in d.ToCharArray()){if(!v(e))c+=e;}}else{c+=d;}c+=' ';}C.WriteLine(c);}}
- Group declarations and use var:
- 342 bytes: using C=System.Console;class j{static bool v(char l){return"aeiou".Contains(l.ToString());}static void Main(){string a=C.ReadLine(),c="";var b=System.Text.RegularExpressions.Regex.Replace(a,"[^a-zA-Z0-9 ]","").Split(' ');foreach(var d in b){if(d.Length>4){foreach(var e in d.ToCharArray()){if(!v(e))c+=e;}}else{c+=d;}c+=' ';}C.WriteLine(c);}}
- Remove and sustitute v(e):
- 308 bytes: using C=System.Console;class j{static void Main(){string a=C.ReadLine(),c="";var b=System.Text.RegularExpressions.Regex.Replace(a,"[^a-zA-Z0-9 ]","").Split(' ');foreach(var d in b){if(d.Length>4){foreach(var e in d.ToCharArray()){if(!"aeiou".Contains(e.ToString()))c+=e;}}else{c+=d;}c+=' ';}C.WriteLine(c);}}
- Remove unnecessary brackets:
- 305 bytes: using C=System.Console;class j{static void Main(){string a=C.ReadLine(),c="";var b=System.Text.RegularExpressions.Regex.Replace(a,"[^a-zA-Z0-9 ]","").Split(' ');foreach(var d in b){if(d.Length>4){foreach(var e in d.ToCharArray())if(!"aeiou".Contains(e.ToString()))c+=e;}else c+=d;c+=' ';}C.WriteLine(c);}}
- Strings are enumerable by default:
- 299 bytes: using C=System.Console;class j{static void Main(){string a=C.ReadLine(),c="";var b=System.Text.RegularExpressions.Regex.Replace(a,"[^a-zA-Z0-9 ]","").Split(' ');foreach(var d in b){if(d.Length>4){foreach(var e in d)if(!"aeiou".Contains(e.ToString()))c+=e;}else c+=d;c+=' ';}C.WriteLine(c);}}
- Remove and substitute a:
- 292 bytes: using C=System.Console;class j{static void Main(){var c="";var b=System.Text.RegularExpressions.Regex.Replace(C.ReadLine(),"[^a-zA-Z0-9 ]","").Split(' ');foreach(var d in b){if(d.Length>4){foreach(var e in d)if(!"aeiou".Contains(e.ToString()))c+=e;}else c+=d;c+=' ';}C.WriteLine(c);}}
- Change WriteLine to Write:
- 288 bytes: using C=System.Console;class j{static void Main(){var c="";var b=System.Text.RegularExpressions.Regex.Replace(C.ReadLine(),"[^a-zA-Z0-9 ]","").Split(' ');foreach(var d in b){if(d.Length>4){foreach(var e in d)if(!"aeiou".Contains(e.ToString()))c+=e;}else c+=d;c+=' ';}C.Write(c);}}
- Use c instead of "":
- 387 bytes: using C=System.Console;class j{static void Main(){var c="";var b=System.Text.RegularExpressions.Regex.Replace(C.ReadLine(),"[^a-zA-Z0-9 ]",c).Split(' ');foreach(var d in b){if(d.Length>4){foreach(var e in d)if(!"aeiou".Contains(e.ToString()))c+=e;}else c+=d;c+=' ';}C.Write(c);}}
- Remove and substitute b:
- 279 bytes: using C=System.Console;class j{static void Main(){var c="";foreach(var d in System.Text.RegularExpressions.Regex.Replace(C.ReadLine(),"[^a-zA-Z0-9 ]",c).Split(' ')){if(d.Length>4){foreach(var e in d)if(!"aeiou".Contains(e.ToString()))c+=e;}else c+=d;c+=' ';}C.Write(c);}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement