fork(1) download
  1. input = "XSDFADDDDA"
  2. gsub("(?:A|(?<!^)\\G)\\K\\p{L}(?=\\p{L}*A)", "A", input, perl=TRUE)
  3.  
Success #stdin #stdout 0.29s 22832KB
stdin
Standard input is empty
stdout
[1] "XSDFAAAAAA"