     "source": [
      "class CompressString(object):\n",
      "\n",
      "    def compress(self, string):\n",
      "        if string is None or len(string) == 0:\n",
      "            return string\n",
      "        result = ''\n",
      "        prev_char = string[0]\n",
      "        count = 0\n",
      "        for char in string:\n",
 
</s> remove     "        result += prev_char + (str(count) if count > 1 else '')\n",
    "        return result if len(result) < len(string) else string"
 </s> add     "        result += self._calc_partial_result(prev_char, count)\n",
    "        return result if len(result) < len(string) else string\n",
    "\n",
    "    def _calc_partial_result(self, prev_char, count):\n",
    "        return prev_char + (str(count) if count > 1 else '')" </s> remove     "                result += prev_char + (str(count) if count > 1 else '')\n",
 </s> add     "                result += self._calc_partial_result(prev_char, count)\n",
    "        if string is None or not string:\n",
     "source": [
      "class CompressString(object):\n",
      "\n",
      "    def compress(self, string):\n",
    "        if string is None or not string:\n",
      "            return string\n",
      "        result = ''\n",
      "        prev_char = string[0]\n",
      "        count = 0\n",
      "        for char in string:\n",
keep keep keep keep replace keep keep keep keep keep
 Polish compress string (#101)

Fix empty string check, move duplicate code to a method. 
arrays_strings/compress/compress_solution.ipynb