#!/usr/bin/perl -w

use strict;
use v5.30;

chomp (my $in = <>);
while ($in =~ /\((\d+)x(\d+)\)/g) {
	my $p = pos($in) - length("($1x$2)");
	my $str = substr($in, pos($in), $1);
	my $repl = $str x $2;
	say "repl=$repl";
	substr($in, $p, length($str)+length("($1x$2)")) = $repl;
	pos($in) = $p + length $repl;
}

say $in;
say length $in;
