我试图在(2 char)字符串示例中找到最小模式:
enter code here
#!/usr/bin/perl
use warnings;
use strict;
my $str1;
$str1 = 'abbabbabbabbabb'; # abb is repeating
$str1 = 'abababababababa'; # ab is repeating
$str1 = 'abaaaabaaaabaaa'; # abaaa is repeating
$str1 = 'bbaabbaabbaabbaa'; # bbaa is repeating
它总是2个字符'a'和'b',并且总是有一个模式,没有'a'或'b'的极端情况。任何帮助是极大的赞赏。
谢谢迈克尔