In order to de-crypt a message, I need to first find the key. From the given information, I find the key is part of the string:
str = "251220825122082"
We can easily get that the key should be "2512208
" since the key is supposed to be repeatedly used in encrypting a message. However, I tried many methods and got the answer "25122082
", which adds another 2 in the end, but it's just another beginning of the key.
The method I have tried:
- regex:
String repeated = str.replaceAll("(.+?)\\1+", "$1");
- LRS Java
These two provide the same answer("25122082
").
Can anyone help me with this problem?
Thank you!