Algorithm4

1:\n", " print('?')\n", "else:\n", " print(key_list[value_list.index(most_pop)])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 1152\t단어의 개수" ] }, { "cell_type": "code", "execution_count": 52, "metadata": {}, "outputs": [ { "name": "stdin", "output_type": "stream", "text": [ " The Curious Case of Benjamin Button\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "6\n" ] } ], "source": [ "words = input().split()\n", "print(len(words))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2908\t상수" ] }, { "cell_type": "code", "execution_count": 56, "metadata": {}, "outputs": [ { "name": "stdin", "output_type": "stream", "text": [ " 734 893\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "437\n" ] } ], "source": [ "numbers = list(map(int, input()[::-1].split()))\n", "if numbers[0] > numbers[1]:\n", " print(numbers[0])\n", "else:\n", " print(numbers[1])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 5622\t다이얼" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "word = input()\n", "result = 0\n", "dial = {2:'ABC', 3:'DEF', 4:'GHI', 5:'JKL', 6:'MNO', 7:'PQRS', 8:'TUV', 9:'WXYZ'}\n", "for letter in word:\n", " for i in range(2,10):\n", " if letter in dial.get(i):\n", " result += i\n", "print(result + len(word))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2941\t크로아티아 알파벳" ] }, { "cell_type": "code", "execution_count": 40, "metadata": {}, "outputs": [ { "name": "stdin", "output_type": "stream", "text": [ " ljes=njak\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "6\n" ] } ], "source": [ "word = input()\n", "croa = ['c=', 'c-', 'd-', 'lj', 'nj', 's=','dz=','z=']\n", "\n", "for i in croa:\n", " word = word.replace(i, '1')\n", " \n", "print(len(word))" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.6" } }, "nbformat": 4, "nbformat_minor": 4 }