### Problem Statement

You are given two strings of digits, single and multiple. Your job is to find the length of the longest substring (which may be the whole string) of digits in single such that there is a corresponding substring (of the same length) in multiple which satisfies the following constraint. Each digit in the substring of multiple is the same exact integer multiple of the corresponding digit in the substring of single. So "48" is a multiple (4) of "12", but "72" is not a multiple of "36". Multiplication factors from 0 to 9 are possible. Leading zeros are *allowed* in single and multiple and all substrings.

For example: in "3211113321571" and "5555266420", here are a few (but not all) of the multiples:

```"3211113321571"        "5555266420"
"-----------7-"  x 0 = "---------0"
"--------2----"  x 1 = "----2-----"
"--11---------"  x 6 = "-----66---"
"321----------"  x 2 = "------642-"
"--1111-------"  x 5 = "5555------"
"-----13321---"  x 2 = "----26642-"
```

The answer is 5, the length of the longest string with a multiple, "13321".

### Definition

 Class: DigitMultiples Method: getLongest Parameters: String, String Returns: int Method signature: int getLongest(String single, String multiple) (be sure your method is public)

### Notes

-Each digit multiple must be exactly a single digit. For example: '3' x 4 never matches.

### Constraints

-single will have between 1 and 50 characters inclusive.
-multiple will have between 1 and 50 characters inclusive.
-each character of single will be between '0' and '9' inclusive.
-each character of multiple will be between '0' and '9' inclusive.

### Examples

0)

 `"3211113321571"` `"5555266420"`
`Returns: 5`
 The example from above. Longest multiple = "13321" x 2 = "26642"
1)

 `"100200300"` `"100400600"`
`Returns: 8`
 "00200300" x 2 = "00400600"
2)

 `"111111111100000000000000000000000000000000000"` `"122333444455555666666777777788888888999999999"`
`Returns: 9`
3)

 `"000000000000"` `"000000000000"`
`Returns: 12`
 Any integer multiple works here.
4)

 `"11111111111"` `"11111111111"`
`Returns: 11`
 The factor is one.
5)

 `"89248987092734709478099"` `"00000000000000000000000"`
`Returns: 23`
 The factor is zero.
6)

 `"11111111111111111111111111111111111111111111111111"` `"00000000000000000000000001111111111111111111111111"`
`Returns: 25`

#### Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=2450

#### Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=4780&pm=2450

Rustyoldman

#### Testers:

lbackstrom , brett1479

#### Problem categories:

Brute Force, Simple Math