fork download
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use utf8;
  5. binmode STDOUT, "utf8";
  6. binmode STDERR, "utf8";
  7.  
  8. sub odai_pt15_467 {
  9. my @args = @_;
  10. foreach (@args) {
  11. s/(.)\1+/sprintf("%s%d", $1, length($&))/ge;
  12. }
  13. @args
  14. }
  15.  
  16. foreach ("あいうえお",
  17. "ああいいうう",
  18. "あいうあいう",
  19. "ああああ",
  20. "🐤🐤🐤🐤") {
  21. print odai_pt15_467 $_, "\n";
  22. }
  23.  
Success #stdin #stdout 0s 5100KB
stdin
Standard input is empty
stdout
あいうえお
あ2い2う2
あいうあいう
あ4
🐤4