Data Encoding
Given a string S, your job is to encode it into a new string T using given charset C. To make the decoding easy, each original character X in S is encoded into a string Y made up of characters in C. What's more, for two different X1 and X2, Y1 must be different from Y2 and all its non-empty prefixes. What's the minimum possible length of T?
Input
There are multiple test cases. Each test case contains two lines, S and C. The length of S will be at most 100000. The length of C will be at least 2 and all characters in C will be different.