fork(1) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main() {
  7. string s;
  8. while ((s = Console.ReadLine()) != null) {
  9. s = Regex.Replace(s, "[!?.]*([!?.])", "$1");
  10. Console.WriteLine(s);
  11. }
  12. }
  13. }
Success #stdin #stdout 0.05s 134720KB
stdin
"This is a string....!"
"This is another...!!"
"What is this..!?!?"
stdout
"This is a string!"
"This is another!"
"What is this?"