v***o 发帖数: 287 | 1 public static void compressString(char[] input)
{
if (input == null)
return;
int previous = 0, current = 0, count = 0;
while (current < input.length)
{
if (input[current]!= input[previous])
{
insertInt(input, previous +1, Integer.toString(count));
input[previous + Integer.toString(count).length + 1] = input[
current];
previous = current;
current ++;
count = 0;
}
else
{ current... 阅读全帖 |
|