Common factor Time Limit: 1000 MS Memory limit: 65536K Title Description assume that a string also has a factor. A string is s1 and can then be represented by n strings s2, s2 is the factor of s1. For example, "ac" is a factor of "acac. Give two strings and find the public factor of them. Input Multiple groups of data, given two strings, s1, s2. It cannot exceed 100000 characters in length and does not contain spaces. Output one row of data in each group, with the public factor. Input acacacaaaaa sample output 11 Prompt calculate the common factor of length [cpp] # include <stdio. h> # include <string. h> # include <math. h> int a [1000000], B [1000000]; char s1 [1000000], s2 [1000000], s3 [1000000]; int main () {int I, j, n, m, s, t, l1, l2, top, top1, x; while (scanf ("% s", s1, s2 )! = EOF) {l1 = strlen (s1); s = 0; for (I = 1, top = 0; I <= l1; I ++) {if (l1% I = 0) {a [top ++] = I ;}} for (I = 0, top1 = 0; I <= top-1; I ++) {for (j = 0; j <= a [I]-1; j ++) {s3 [j] = s1 [j];} if (a [I] = l1) {B [top1 ++] = a [I]; continue;} for (j = a [I]; j <= l1-1; j + = a [I]) {for (x = 0; x <= a [I]-1; x ++) {if (s3 [x]! = S1 [j + x]) {break;} if (x! = A [I]) {break;} if (j = l1) {B [top1 ++] = a [I] ;}} l2 = strlen (s2 ); for (I = 0; I <= top1-1; I ++) {if (l2% B [I] = 0) {for (j = 0; j <= l2-1; j + = B [I]) {for (x = 0; x <= B [I]-1; x ++) {if (s1 [x]! = S2 [j + x]) {break;} if (x! = B [I]) {break ;}} if (j = l2) {s ++ ;}} printf ("% d \ n", s );} return 0 ;}