problem_id stringlengths 6 6 | user_id stringlengths 10 10 | time_limit float64 1k 8k | memory_limit float64 262k 1.05M | problem_description stringlengths 48 1.55k | codes stringlengths 35 98.9k | status stringlengths 28 1.7k | submission_ids stringlengths 28 1.41k | memories stringlengths 13 808 | cpu_times stringlengths 11 610 | code_sizes stringlengths 7 505 |
|---|---|---|---|---|---|---|---|---|---|---|
p02939 | u152614052 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = list(input())\ncnt = 0\nfor i in range(len(s)-1):\n if s[i] == s[i+1]:\n cnt += 1\nif cnt > 0 and cnt % 2 == 0:\n print(len(s)-cnt+1)\nelif cnt > 0 and cnt % 2 != 0:\n print(len(s)-cnt)\nelse:\n print(len(s))', 's = list(input())\ncnt, i = 0, 1\nl = len(s)\n\nwhile i < l:\n if s[i] == s[i-1... | ['Wrong Answer', 'Accepted'] | ['s947170112', 's865442205'] | [10640.0, 10516.0] | [68.0, 67.0] | [222, 136] |
p02939 | u163320134 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["s=input()+'!'\nl=len(s)\nans=1\npos=1\ntmp=s[0]\nflag=0\nwhile pos<l:\n if s[pos]!=tmp:\n tmp=s[pos]\n ans+=1\n pos+=1\n else:\n if s[pos]==tmp:\n tmp=s[pos:pos+2]\n ans+=1\n pos+=2\n print(ans,pos,tmp)\nans-=1\nprint(ans)", "s=input()+'!'\nl=len(s)\nans=1\npos=1\ntmp=s[0]\nflag=0\nwhile... | ['Wrong Answer', 'Accepted'] | ['s586669333', 's407736989'] | [6364.0, 3500.0] | [353.0, 85.0] | [234, 213] |
p02939 | u169696482 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = input()\nn = len(S)\nA = [S[0]]\nB = [S[0:2]]\ni = 0\nj = 0\nwhile i< n-1:\n if A[j] != S[i+1]:\n A.append(S[i+1])\n i += 1\n j+=1\n else:\n A.append(S[i+1:i+3])\n i += 2\n j += 1\ni = 1\nj = 0\nwhile i< n-1:\n if B[j] != S[i+1]:\n B.append(S[i+1])\n i += 1\n j+=1\n else:\n B.app... | ['Wrong Answer', 'Accepted'] | ['s240452189', 's775704111'] | [16252.0, 12828.0] | [252.0, 224.0] | [432, 421] |
p02939 | u174394352 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["S = input()\nans = 0\np = ''\ni = 0\n\nwhile i < len(S):\n ans+=1\n if p==S[i]:\n i+=2\n p=''\n else:\n p=S[i]\n i+=1\nprint(ans)\n", "S = input()\nans = 0\np = ''\ni = 0\n\nwhile i < N:\n ans+=1\n if p==S[i]:\n i+=2\n p=''\n else:\n i+=1\n p=S[i]\n \nprint(ans)", "S = input()\nans = ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s094170087', 's326170565', 's364756595'] | [3500.0, 3500.0, 3500.0] | [97.0, 18.0, 91.0] | [132, 131, 165] |
p02939 | u175034939 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\npr = s[0]\ncnt = 0\ni = 0\nwhile i < len(s)-1:\n if len(pr) == 1:\n if s[i+1] == pr:\n if i+2 < len(s)-1:\n cnt += 1\n pr = s[i+1:i+3]\n i += 2\n else:\n break\n else:\n cnt += 1\n pr ... | ['Runtime Error', 'Accepted'] | ['s218767534', 's344806090'] | [3500.0, 3628.0] | [112.0, 181.0] | [405, 634] |
p02939 | u212328220 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\n\nnow = s[0]\nprint(now)\ncnt = 1\ni = 1\nwhile True:\n if s[i] != now:\n cnt += 1\n now = s[i]\n i += 1\n else:\n now = now + s[i]\n cnt += 1\n i += 2\n if i > len(s)-1:\n cnt -= 1\n if i >= len(s):\n break\nprint(cnt)', 's = in... | ['Wrong Answer', 'Accepted'] | ['s382078672', 's111407834'] | [9336.0, 9284.0] | [83.0, 84.0] | [289, 318] |
p02939 | u261260430 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["import sys\n\nfinput = lambda: sys.stdin.readline()\n\ndef solve():\n s = finput()\n ans = 0\n t = p = ''\n\n for i in range(len(s)):\n t += s[i]\n if t == p:\n continue\n p = t\n t = ''\n ans += 1\n\n print(ans)\n\n\nif __name__ == '__main__':\n solve()", 'import sys\nfrom itertools import ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s070475941', 's076612445', 's083251372', 's198771280', 's256389479', 's274082349', 's417440031', 's441859380', 's442727282', 's519080219', 's530335648', 's602524063', 's813531398', 's829838282', 's977485664', 's986998072', 's237738111'] | [3444.0, 38848.0, 14824.0, 38848.0, 8060.0, 10592.0, 38312.0, 39788.0, 3444.0, 38844.0, 3444.0, 4940.0, 38904.0, 3444.0, 3444.0, 3444.0, 38424.0] | [44.0, 350.0, 320.0, 302.0, 149.0, 705.0, 623.0, 446.0, 49.0, 368.0, 48.0, 173.0, 393.0, 48.0, 17.0, 113.0, 678.0] | [259, 626, 629, 594, 415, 635, 620, 603, 218, 633, 304, 603, 621, 261, 352, 342, 636] |
p02939 | u262801165 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\n\nans = 0\np = "0"\nq = ""\nfor i in range(len(s)):\n if p == "0":\n ans += 1\n p = s[i]\n continue\n\n q += s[i]\n if q == p:\n continue\n else:\n ans += 1\n p = s[i]\n q = ""\n\nprint(ans)\n \n \n \n \n\n ... | ['Wrong Answer', 'Accepted'] | ['s333030022', 's561450162'] | [3500.0, 3500.0] | [98.0, 88.0] | [366, 371] |
p02939 | u266569040 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = input()\n\ncount = 1\nsentence = S[0]\ni=1\n\nwhile i < len(S):\n print(sentence, S[i], count)\n if sentence != S[i]:\n sentence = S[i]\n count += 1\n i+=1\n elif i==len(S)-1:\n break\n else:\n count += 1\n sentence = S[i:i+2]\n i+=2\n\nprint(count)\n\n... | ['Wrong Answer', 'Accepted'] | ['s787180747', 's555129591'] | [5636.0, 3500.0] | [388.0, 98.0] | [297, 264] |
p02939 | u276204978 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = input()\nans, prev, cur = 0, "", ""\nfor s in S:\n cur += \n if cur != prev:\n ans += 1\n prev, cur = cur, ""\nprint(ans)', 'S = input()\nans, prev, cur = 0, "", ""\nfor s in S:\n cur += s\n if cur != prev:\n ans += 1\n prev, cur = cur, ""\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s858061761', 's469567889'] | [2940.0, 3500.0] | [17.0, 71.0] | [138, 139] |
p02939 | u278183305 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\nskip = False\nans = [s[0]]\nn = 0\nfor i in range(len(s))[1:]:\n if skip == True:\n skip = False\n continue\n elif ans[n] == s[i] and i+1 < len(s):\n ans.append(s[i]+s[i+1])\n skip = True\n n += 1\n else:\n ans.append(s[i])\n n += 1\nprint(len(ans... | ['Wrong Answer', 'Accepted'] | ['s621064124', 's482500623'] | [8064.0, 8068.0] | [108.0, 108.0] | [305, 351] |
p02939 | u285007577 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['#coding: utf-8;\nimport itertools\nimport math\n\ndef hoge(i,flag):\n s = list(flag)\n s[i] = "B"\n return "".join(s)\n\nN = int(input())\ndata = input()\n\nR=[]\nG=[]\nB=[]\ncount = 0\n\nfor i,c in enumerate(data):\n if c=="R":\n R.append(i)\n continue\n if c=="G":\n G.append(i)\n continue\n if c==... | ['Runtime Error', 'Accepted'] | ['s394215786', 's551247425'] | [3628.0, 3500.0] | [19.0, 109.0] | [832, 371] |
p02939 | u291766461 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = input()\nans = ["-1"]\nt = ""\nfor c in S:\n t += c\n if t != ans[-1]:\n ans.append(t)\n t = ""\nprint(ans)\nprint(len(ans)-1)', 'S = input()\nans = ["-1"]\nt = ""\nfor c in S:\n t += c\n if t != ans[-1]:\n ans.append(t)\n t = ""\nprint(len(ans)-1)'] | ['Wrong Answer', 'Accepted'] | ['s096008782', 's750091850'] | [10236.0, 8068.0] | [82.0, 70.0] | [141, 130] |
p02939 | u296441124 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['\n\n\n# if len(in_str) == 0:\n# return 0\n\n\n\n# continue\n# else:\n# new_str = in_str[i+1:]\n\n\n# continue\n# return 1 + ret\n#\n# return -1\n\n\ndef func( in_str: str ):\n result = 0\n prev =""\n new_str = in_str\n stack_str =... | ['Memory Limit Exceeded', 'Accepted'] | ['s256757815', 's551470748'] | [1353772.0, 20352.0] | [771.0, 1413.0] | [1582, 1756] |
p02939 | u301984327 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['import sys\nsys.setrecursionlimit(10000)\n\n\ns = input()\nnum = len(s)\nans = 0\n\ndef count(pos, befor, co):\n global ans\n if pos >= num:\n if ans < co:\n ans = co\n return True\n \n for p in range(1, num-pos+1):\n if ans > co + len(s[pos+p:]) + 1:\n break\n if s[pos:pos+p] != befor:\n ... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s436418948', 's681733053', 's878704327', 's924403762', 's109184879'] | [13192.0, 5884.0, 5884.0, 3500.0, 3500.0] | [334.0, 532.0, 550.0, 114.0, 250.0] | [418, 547, 528, 464, 514] |
p02939 | u306412379 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = list(input())\n\na = S[0]\nc = 1\nwhile len(S) >1:\n if S[1] == a:\n if len(S) >2:\n a = S[1:3]\n S = [a] + S[3:]\n c += 1\n else:\n break\n else: \n a = S[1]\n S = [a] + S[2:]\n c += 1\n print(S)\nprint(c) ', "ss = input()\n\nn = len(ss)\narrs = [ss[0]]\n\nfor i in range(1... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s151740571', 's209787550', 's304465766', 's393721425'] | [142400.0, 14916.0, 13968.0, 14864.0] | [1730.0, 2206.0, 113.0, 101.0] | [234, 384, 342, 443] |
p02939 | u306950978 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\nn = len(s)\nans = 1\nkar = s[0]\nfor i in range(n-1):\n if kar == s[i+1]:\n kar = kar + s[i+1]\n elif kar != s[i+1]:\n kar = s[i+1]\n ans += 1\n \nprint(ans)', 's = list(input())\nn = len(s)\nmae = ""\nnow = ""\nans = 0\nfor i in range(n):\n now = now + s[i]\n if m... | ['Wrong Answer', 'Accepted'] | ['s010005565', 's489098794'] | [3628.0, 4840.0] | [106.0, 87.0] | [193, 181] |
p02939 | u332906195 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["S = input() + 'A'\nans, prev, next = 1, [S[0]], []\nprint(prev)\nfor i in range(1, len(S)):\n if len(next) == 0 or prev == next:\n next.append(S[i])\n else:\n print(next)\n ans, prev, next = ans + 1, next, [S[i]]\n\nprint(ans)\n", "S = input() + 'A'\nans, prev, next = 1, [S[0]], []\nfor i i... | ['Wrong Answer', 'Accepted'] | ['s723960499', 's392486961'] | [4628.0, 3500.0] | [268.0, 104.0] | [244, 212] |
p02939 | u340153434 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = input()\ncount = 0\ni = 0\nwhile i < len(S)-2:\n if S[i] == S[i+1]:\n print(S[i])\n print(S[i+1]+S[i+2])\n i +=3\n count += 2 \n else:\n print(S[i])\n i +=1\n count += 1\nif S[i] == S[i+1]:\n count += 1\nelse:\n count += 2\nprint(count)', "S = input()\... | ['Runtime Error', 'Accepted'] | ['s660635769', 's535453487'] | [4212.0, 8424.0] | [231.0, 89.0] | [285, 237] |
p02939 | u343850880 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = [i for i in input()]\ncount = 1\ns0 = s[0]\nflag = 0\nfor i in range(1, len(s)):\n if flag==1:\n flag = 0\n continue\n if s0==s[i]:\n s0 = s[i] + s[i+1]\n flag = 1\n else:\n s0 = s[i]\n count += 1\n print(s0)\nprint(count)', 's = [i for i in input()]\ncount = 1\ns... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s066200506', 's169564301', 's651533674'] | [5676.0, 5096.0, 5096.0] | [186.0, 87.0, 88.0] | [261, 247, 321] |
p02939 | u347452770 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input().split()\n\nn = len(s)\n\ncounter = 0\n\nfor i in range(n-1):\n if s[i] == s[i+1]:\n counter += 1\n \nprint(n - counter + 1)', 's = input()\n \nn = len(s)\n \nadding = ""\nadded = ""\n \ncounter = 0\n \nfor i in range(n):\n adding += s[i]\n if adding != added:\n counter += 1\n added = adding... | ['Wrong Answer', 'Accepted'] | ['s966401083', 's076713279'] | [3500.0, 3500.0] | [18.0, 84.0] | [132, 196] |
p02939 | u353895424 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['\ns = list(input())\n\nn = len(s)\nhst = []\nsk = ""\n\nfor i in range(n):\n sk += s[i]\n if i == 0:\n hst.append(sk)\n sk = ""\n elif hst[-1] != sk:\n hst.append(sk)\n sk = ""\n\nprint(hst)\nprint(len(hst))', 's = list(input())\n\nn = len(s)\nhst = ["#"]\nsk = ""\n\nfor i in rang... | ['Wrong Answer', 'Accepted'] | ['s771908097', 's479023710'] | [11808.0, 9404.0] | [106.0, 88.0] | [262, 164] |
p02939 | u357751375 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\nt = s[0]\np = 1\ni = 1\nwhile i < len(s):\n if s[i] == t:\n i += 2\n else:\n i += 1\n t = s[i-1]\n p += 1\n\nprint(p)', 's = list(input())\ni = len(s)\nans = 0\nwhile i >= 3:\n if s[i-1] != s[i-2]:\n i -= 1\n ans += 1\n else:\n i -= 3\n ans += 2... | ['Runtime Error', 'Accepted'] | ['s922501387', 's303048655'] | [9208.0, 10644.0] | [84.0, 78.0] | [144, 261] |
p02939 | u373047809 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['k = 0\ns = t = ""\nfor i in input():\n\ts += i\n if s != t:\n\t\tk += 1\n\t\ts, t = "", s\nprint(k)\n', 'c = 0\ns = f = ""\nfor i in input():\n s += i\n if s != f:\n c += 1\n s, f = "", s\nprint(c)'] | ['Runtime Error', 'Accepted'] | ['s069183967', 's399771019'] | [2940.0, 3500.0] | [17.0, 65.0] | [91, 93] |
p02939 | u375282392 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\nit=0\ncon = 1\nwhile it+1 < len(s):\n\tif s[it] == s[it+1]:\n\t\tif it + 2 == len(s):\n\t\t\tit += 2\n\t\t\tcon += 0\n\t\telif it + 3 == len(s):\n\t\t\tit += 3\n\t\t\tcon += 1\n else:\n\t\t\tit += 3\n\t\t\tcon += 2\n\telse:\n\t\tit += 1\n\t\tcon += 1\nprint(con)', "s = input()\nit=0\ncon = 1\ntmp ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s516776024', 's708580830', 's283066134'] | [2940.0, 3500.0, 3500.0] | [17.0, 107.0, 102.0] | [237, 170, 231] |
p02939 | u377989038 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()', 's = input()\nl = len(s)\ni, cnt = 0, 0\npre = ""\n\nwhile i < l:\n if pre == s[i]:\n if i + 1 < l:\n pre = s[i:i + 2]\n i += 1\n else:\n break\n else:\n pre = s[i]\n cnt += 1\n i += 1\n\nprint(cnt)'] | ['Wrong Answer', 'Accepted'] | ['s216194618', 's923788593'] | [3504.0, 3500.0] | [17.0, 88.0] | [11, 246] |
p02939 | u403301154 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\nans = len(s)\nf = 0\nif len(s)==2 and len(set(s))==1:\n print(1)\n exit()\nfor i in range(1, len(s)):\n if f==1:\n f = 0\n ans -= 1\n elif f==0 and s[i]==s[i-1] and i==len(s)-1:\n ans -= 1\n elif f==0 and s[i]==s[i-1]:\n f = 1\n else:\n continue\nprint(ans)', 's = input()\nans = len(... | ['Wrong Answer', 'Accepted'] | ['s682350595', 's634777883'] | [3500.0, 3500.0] | [108.0, 65.0] | [275, 231] |
p02939 | u408620326 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['import sys\nfrom collections import deque\nimport copy\ninput = sys.stdin.readline\n\nS = deque(list(input()))\npre = deque()\ncnt = 0\nl = deque()\nwhile S:\n while S:\n l.append(S.popleft())\n if l == pre:\n if S:\n l.append(S.popleft())\n pre = copy.deepcop... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s958111226', 's989085103', 's527007081'] | [6884.0, 5544.0, 3500.0] | [2104.0, 2104.0, 41.0] | [562, 295, 286] |
p02939 | u409306788 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['import sys\ninput = sys.stdin.readline\n\n# A - Dividing a String\nS = input()\n\narr = [S[0]]\ni = 1\n\nwhile i < len(S):\n\ts = S[i]\n\t\n\tif s == arr[-1]:\n\t\tif i + 1 < len(S):\n\t\t\ti += 1\n\t\t\ts += S[i]\n\t\telse:\n\t\t\tarr[-1] += s\n\t\t\tbreak\n\t\n\tarr.append(s)\n\ti += 1\n\nans = len(arr)\n\nif arr[-... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s142357481', 's351565507', 's982134360', 's578009408'] | [7980.0, 7980.0, 7980.0, 8068.0] | [109.0, 127.0, 111.0, 107.0] | [307, 483, 307, 223] |
p02939 | u415154163 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = input()\n\ndivide_count = 0\nprevious_s = S[0]\ncount_same_s = 1\nskip_flag = False\ns_len = len(S)\n\n\ndef get_divide(s_len: int):\n if s_len <= 2:\n return 1\n two_divide = s_len//2 #4\n mod = s_len%2 #0\n for i in range(1,two_divide+1):\n if (3*i + mod -1) > two_divide:\n ... | ['Wrong Answer', 'Accepted'] | ['s929989502', 's935999450'] | [3500.0, 8064.0] | [145.0, 86.0] | [1287, 309] |
p02939 | u426764965 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["S = str(input())\nans = 0\np = ''\nq = ''\nfor s in S:\n p += s\n if p != q:\n ans += 1\n q = p\n p = ''\nelse:\n if len(p) > 0:\n ans += 1\nprint(ans)", "S = str(input())\nans = 0\np = ''\nq = ''\nfor s in S:\n p += s\n if p != q:\n ans += 1\n q = p\n p = ''\nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s977924483', 's222043729'] | [3500.0, 3500.0] | [66.0, 65.0] | [153, 117] |
p02939 | u458691711 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['str = input()\nc = list(str)\ns = []\n\nc_now = ""\ns_now = ""\n\ncnt = 0\nc_len = len(c)\n\nfor i in range(len(c)):\n if s_now != c_now:\n s.append(c_now)\n s_now = c_now\n cnt = cnt + 1\n if i != len(c)-1:\n c_now = c[i+1]\n else:\n c_now += c[i]\n\n\nif c[c_len-6... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s485140080', 's673829997', 's786183871', 's978054638'] | [13060.0, 13724.0, 2940.0, 3500.0] | [255.0, 145.0, 18.0, 82.0] | [1643, 1656, 9, 171] |
p02939 | u460245024 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["S = input()\n\nans = 1\nsl = 'a'\nsr = ''\nfor i in range(1, len(S)):\n current_sr = sr + S[i]\n if sl != current_sr:\n ans += 1\n sl = current_sr\n sr = ''\n else:\n sr = current_sr\n\nif len(sr) > 0:\n ans += 1\n\nprint(ans)\n", "S = input()\n\nlen_s = len(S)\nans = 0\ni = 0\... | ['Wrong Answer', 'Accepted'] | ['s014154271', 's368636717'] | [3500.0, 3500.0] | [84.0, 109.0] | [250, 367] |
p02939 | u499106786 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['i = input()\n\nprev = ""\nres = 0\nindex = 0\ncol = []\nwhile index < len(i):\n temp = i[index]\n if temp == prev:\n prev = i[index:index+2]\n\tif index == len(i)-1:\n res -= 1\n\tindex += 2\n\n else:\n prev = temp\n index += 1\n col.append(prev)\n res += 1\n\nprint(res)... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s170488138', 's735316774', 's144446517'] | [2940.0, 3500.0, 3500.0] | [17.0, 97.0, 97.0] | [296, 232, 281] |
p02939 | u509739538 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['from collections import defaultdict\n \ndef readInt():\n\treturn int(input())\ndef readInts():\n\treturn list(map(int, input().split()))\ndef readChar():\n\treturn input()\ndef readChars():\n\treturn input().split()\n \ns = readChar()\nif len(s)==1:\n\tprint(1)\n\texit()\nb="-1"\nans=0\nl = [""]\nwhile len(s)>1:\n\ti... | ['Wrong Answer', 'Accepted'] | ['s280756298', 's946858013'] | [15928.0, 14768.0] | [562.0, 560.0] | [459, 460] |
p02939 | u514118270 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = list(input())\ns = 0\nnum = 0\nans = 0\nfor i in range(len(S)):\n if i < num:\n continue\n for j in range(1,len(S)-i):\n if S[i:i+j] != s:\n s = S[i:i+j]\n num = i+j\n ans += 1\n break\nprint(ans+1)', 'S = list(input())\ns = 0\nnum = 0\nans = 0\nfor ... | ['Wrong Answer', 'Accepted'] | ['s344918433', 's305874322'] | [4840.0, 4968.0] | [269.0, 276.0] | [253, 253] |
p02939 | u517152997 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["#\nimport sys\nimport math\nimport numpy as np\nimport itertools\n\n\ns = list(input())\n\nanswer = 0\nt = 0\nu = 0\nfor i in range(len(s)):\n t = t*27 + (ord(s[i])-ord('a')+1)\n # different from -1\n print(i,s[i],answer,u,t)\n\n if t != u:\n u = t\n t = 0\n answer += 1\n \npri... | ['Wrong Answer', 'Accepted'] | ['s013562728', 's432660034'] | [26856.0, 23836.0] | [868.0, 406.0] | [333, 334] |
p02939 | u520276780 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["import sys\nn,k = map(int,input().split( ))\ns = input()\nr0 = list(reversed(s))\nr = ''.join(r0)\ns = s + r\nl = len(s)\nS = [s[i] for i in range(l)]\n\nliteral=list(set(S))\nliteral.sort()\n\nsmall = literal[0]\n\ni=0\nmx=0\ncnt = 0\nnow=-1\ncnd=[]\nwhile i<l:\n if s[i] == small:\n now = i\n cnt = ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s334109528', 's406106970', 's511319181'] | [3636.0, 3500.0, 19160.0] | [20.0, 95.0, 298.0] | [995, 859, 611] |
p02939 | u522293645 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["str = input()\nli = list(str)\n\ntmp = ''\ncnt = 0\n\nfor i in li:\n if tmp==i:\n tmp += i \n else:\n tmp = i\n cnt += 1\n\nprint(cnt)", "str = input()\nli = list(str)\n\ntmp = ''\npre = ''\ncnt = 0\n\nfor i in li:\n tmp+=i\n\n if pre!=tmp:\n cnt+=1\n pre=tmp\n tmp=''\n\nprint(cnt)"] | ['Wrong Answer', 'Accepted'] | ['s709165430', 's610484791'] | [4840.0, 4840.0] | [57.0, 68.0] | [133, 140] |
p02939 | u528825252 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = [i for i in input()]\n \nresult = 1\ni = 0\nwhile i < len(s)-1:\n if s[i] == s[i+1]:\n i = i + 2\n if i > len(s):\n result = result - 1\n else:\n i = i + 1\n result = result + 1\n \nprint(result)', 's = [i for i in input()]\n \nresult = 1\ni = 0\nwhile i < len(s)-1:\n if s[i] == s[i+1]:\n ... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s172458589', 's441645678', 's954368608', 's077474677'] | [2940.0, 5096.0, 2940.0, 5096.0] | [17.0, 145.0, 17.0, 122.0] | [208, 204, 202, 228] |
p02939 | u539517139 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s=input()\nl=len(s)\nc=0\nx=0\nwhile x<l-1:\n if s[x]==s[x+1]:\n c+=2\n x+=3\n else:\n c+=1\n x+=1\nprint(c)', 's=input()\nl=len(s)\nc=1\nx=0\nwhile x<l-1:\n if s[x]==s[x+1]:\n c+=2\n x+=3\n else:\n c+=1\n x+=1\nprint(c)', 's=input()\nl=len(s)\nc=0\nx=0\nwhile x<l-1:\n if s[x]==s[x+1]:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s037113491', 's827680168', 's253258800'] | [3500.0, 3500.0, 3500.0] | [93.0, 93.0, 96.0] | [111, 111, 246] |
p02939 | u541475502 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\ncnt = 0\npre_word = [""]\nprint(s)\ni = 1\nwhile s:\n if pre_word[-1] != s[0:i]:\n pre_word.append(s[0:i])\n s = s[i:]\n i = 0\n cnt += 1\n if s == "":\n break\n i+=1\nprint(cnt)', 's = input()\ncnt = 0\npre_word = [""]\n#print(s)\ni = 1\nwhile s:\n if pre_word[-1] != s[0:i]:\n pre_... | ['Wrong Answer', 'Time Limit Exceeded', 'Accepted'] | ['s047922558', 's339992353', 's112318809'] | [8072.0, 7820.0, 8008.0] | [2104.0, 2104.0, 171.0] | [195, 196, 279] |
p02939 | u557168336 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["S = input()\n\nres = 0\np = ''\nnow = ''\nfor x in S:\n now += x\n if p != now:\n print(now)\n res += 1\n p = now\n now = ''\n\nprint(res)\n", "S = input()\n\nres = 0\np = ''\nnow = ''\nfor x in S:\n now += x\n if p != now:\n #print(now)\n res += 1\n p = no... | ['Wrong Answer', 'Accepted'] | ['s958848016', 's281675067'] | [4212.0, 3500.0] | [161.0, 67.0] | [160, 161] |
p02939 | u579015878 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["ans=0\nS=T=''\nfor i in input():\n S+=i\n if S!=T:\n ans+=1\n print(S)\n S,T='',S\nprint(ans)", "ans=0\nS=T=''\nfor i in input():\n S+=i\n if S!=T:\n ans+=1\n S,T='',S\nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s549301947', 's261631130'] | [4208.0, 3500.0] | [164.0, 71.0] | [112, 95] |
p02939 | u600402037 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s=input()\nl=[]\nans=0\nlast_pos=-1\nfor i in range(len(s)):\n if i<=last_pos:\n continue\n n=1\n while True:\n t=s[i:i+n]\n if t not in l:\n last_pos=i+n-1\n l.append(t)\n ans+=1\n if last_pos==len(s):\n print(ans)\n ... | ['Wrong Answer', 'Accepted'] | ['s985372295', 's859206622'] | [4068.0, 8064.0] | [2104.0, 188.0] | [490, 297] |
p02939 | u606523772 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = input()\ntemp = "A"\ncnt = 0\nK = 0\nwhile(cnt<len(S)):\n for j in range(1, len(S)-cnt+1):\n temp1 = S[cnt:cnt+j]\n print(temp1)\n if temp!=temp1:\n cnt += j\n K+=1\n break\n temp = temp1\nprint(K)', 'S = input()\ntemp = S[0]\nK = 0\ncnt = 1\nfor i in ra... | ['Wrong Answer', 'Accepted'] | ['s070923222', 's221504997'] | [7156.0, 3500.0] | [2104.0, 99.0] | [248, 153] |
p02939 | u612390263 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["s = input()\n\ndef dp(sb, c_1):\n ret = ''\n for i,c in enumerate(sb):\n ret += c\n if c_1 != ret:\n return sb[i+1:], ret\n return False, False\n \nsb = s\nc_1 = ''\ncnt = 0\nwhile True:\n sb, c_1 = dp(sb, c_1)\n #print(c_1)\n if sb == False: \n cnt += 1\n break\n cnt += 1\n if len(sb) == ... | ['Wrong Answer', 'Accepted'] | ['s462330912', 's544556605'] | [3560.0, 3560.0] | [1391.0, 1373.0] | [321, 309] |
p02939 | u617037231 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["\nS = input()\nL = [alphabet for alphabet in S]\nmoji1 = L[0]\nmoji2 = ''\ni = 1\nres = 0\nwhile i < len(L):\n if moji1 == moji2:\n moji2 += L[i]\n i+=1\n if moji1 != moji2 and moji2 != '':\n res += 1\n moji1 = moji2\n moji2 = L[i]\n i += 1\nprint(res)", "\nS = input()\nL = [alphabet for alphabet ... | ['Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s053163823', 's314831259', 's469788045'] | [5096.0, 5096.0, 5096.0] | [2104.0, 2104.0, 187.0] | [344, 346, 348] |
p02939 | u617515020 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s=list(input())\nD=[s[0]]\ni=0\nwhile i < len(s) - 1:\n if s[i+1] == D[-1]:\n D.append(s[i+1]+s[i+2])\n i+=2\n else:\n D.append(s[i + 1])\n i+=1\n\nprint(len(D)-(1 if i == len(s) else 0))', 's=list(input())\nD=[s[0]]\ni=0\nwhile i < len(s) - 1:\n if s[i+1] == D[-1]:\n D.append(s[i+1:i+3])\n i+=2\... | ['Runtime Error', 'Accepted'] | ['s102057736', 's734465787'] | [9408.0, 11812.0] | [125.0, 130.0] | [190, 187] |
p02939 | u622045059 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["import math\nimport fractions\nimport bisect\nimport collections\nimport itertools\nimport heapq\nimport string\nimport sys\nimport copy\nfrom collections import deque\nsys.setrecursionlimit(10**7)\ndef gcd(a,b):return fractions.gcd(a,b) \ndef lcm(a,b):return (a*b) // fractions.gcd(a,b) \ndef iin(): return int(input(... | ['Wrong Answer', 'Accepted'] | ['s286442062', 's686167417'] | [6028.0, 5556.0] | [1465.0, 106.0] | [1377, 1368] |
p02939 | u625729943 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["S = input()\n\ndif = 0\ni = 1\nlast = S[0]\nwhile i < len(S):\n print(last, S[i])\n if last!=S[i]:\n last = S[i]\n i += 1\n else:\n last = ''.join(S[i:i+2])\n i += 2\n dif += 1\n\nprint(len(S)-dif)", "S = input()\n\ndif = 0\ni = 1\nlast = S[0]\nwhile i < len(S):\n if las... | ['Wrong Answer', 'Accepted'] | ['s202250109', 's791725731'] | [4712.0, 3500.0] | [267.0, 98.0] | [226, 205] |
p02939 | u629350026 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s=str(input())\ns=list(s)\nans=1\ni=1\ntemp=s[0]\nwhile True:\n if s[i]!=temp:\n ans=ans+1\n temp=s[i]\n i=i+1\n else:\n temp=s[i]+s[i+1]\n i=i+2\n ans=ans+1\n if i>len(s)-1:\n break\nprint(ans)', 's=str(input())\ns=list(s)\nans=1\ni=1\ntemp=s[0]\nwhile True:\n if s[i]!=temp:\n ans=ans+1\n... | ['Runtime Error', 'Accepted'] | ['s170431822', 's680297503'] | [4840.0, 4840.0] | [97.0, 102.0] | [202, 247] |
p02939 | u649591440 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['N,K = (int(i) for i in input().split())\nS = input()\n\na = [S]\nres = []\n\nfor i in range(K):\n res = []\n \n for k in a:\n Ss = k[::-1]\n SSs = k + Ss\n a = []\n \n for j in range(len(S)):\n a.append(SSs[j:len(S)+j])\n res.append(SSs[j:len(S)+j])\n \nprint(min(res))', "S = input()\n\na =... | ['Runtime Error', 'Accepted'] | ['s283248488', 's169501727'] | [3500.0, 3500.0] | [20.0, 67.0] | [278, 171] |
p02939 | u658801777 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['while True:\n try:\n S = input()\n result = 0\n prev = None\n cur = ""\n print(S)\n for c in S:\n if prev is None:\n prev = c\n result += 1\n print(prev, cur, result)\n continue\n cur += c\n ... | ['Wrong Answer', 'Accepted'] | ['s497598303', 's556583909'] | [6048.0, 3500.0] | [382.0, 78.0] | [558, 422] |
p02939 | u663710122 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['import numpy as np\n\nS = input()\nN = len(S)\n\ndp = np.full((N + 1, 3), 0)\ndp[0][0] = 0\n\nfor i in range(N):\n for d_1 in range(1, 3):\n for d_2 in range(1, 3):\n a = i - d_1\n p = i + d_2\n\n print(S[a:i], S[i:p])\n\n if p >= N:\n continue\n ... | ['Wrong Answer', 'Accepted'] | ['s258870497', 's033546727'] | [21156.0, 11368.0] | [2109.0, 117.0] | [530, 230] |
p02939 | u666415539 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S=input()\n\ni=1\nK=1\nlastword=[]\nlastword.append(S[0])\nwhile i<= (len(S)-1):\n if i==len(S)-1:\n if len(lastword[-1])==1 and S[i]!=S[i-1] or len(lastword[-1])==2:\n K+=1\n break\n elif len(lastword[-1])==1 and S[i]==S[i-1]:\n if lastword[-3]==lastword[-1]:\n break\n else:\n ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s832782484', 's972753189', 's834952316'] | [8296.0, 134632.0, 8296.0] | [173.0, 1655.0, 168.0] | [599, 598, 629] |
p02939 | u667024514 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = str(input())\nnum = len(s)\ndp = [[0,0] for i in range(n+1)]\nfor i in range(n):\n for j in [1,2]:\n for k in [1,2]:\n if i + k <= n:\n a = s[i-j:i]\n b = s[i:i+k]\n if a != b:\n dp[i+k][k-1] = max(dp[i+k][k-1],dp[i][j-1]+1)\nprint(max(dp[n]))', 's = str(input())\nn = len(s)... | ['Runtime Error', 'Accepted'] | ['s307565935', 's503883256'] | [3500.0, 38160.0] | [18.0, 1148.0] | [275, 273] |
p02939 | u668503853 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S=input()\nl=len(S)\n\nC=[]\nfor i in range(l):\n for j in range(l+1):\n C.append(S[i:j])\nC2=[x for x in C if x]\nli=[]\ns=0\nfor k in range(l):\n g=s+l-k\n li.append(C2[s:g])\n s=g\nprint(l)\n ', 'S = input()\n\nif len(S) == 1:\n print(1)\n exit(0)\n\nnow = S[0]\nk = 1\nl = 2\nans = 1\nwhile k < len... | ['Runtime Error', 'Accepted'] | ['s043282214', 's001776591'] | [7256.0, 3500.0] | [4518.0, 153.0] | [190, 323] |
p02939 | u672475305 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\nlst = []\n\nif len(s) == 1:\n print(1)\n exit()\n\nq = 0\nwhile q <= len(s)-2:\n if s[q] == s[q+1]:\n lst.append(s[q])\n if q+1 != len(s)-1:\n lst.append(s[q+1:q+3])\n q += 3\n else:\n lst.append(s[q])\n q += 1\nelse:\n ans = len(lst)\n text... | ['Wrong Answer', 'Accepted'] | ['s615323328', 's335276340'] | [9700.0, 9700.0] | [146.0, 139.0] | [436, 457] |
p02939 | u684743124 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s=input()\ni=1\ns0=s[0]\nct=1\nwhile i<len(s)-1:\n print(s0)\n if s0==s[i]:\n s0=s[i:i+2]\n i+=2\n else:\n s0=s[i]\n i+=1\n ct+=1\nif i>len(s):\n print(ct)\nelif s0==s[i]:\n print(ct)\nelse:\n print(ct+1)', 's=input()\ni=1\ns0=s[0]\nct=1\nwhile i<len(s)-1:\n if s0==s[i]:\n s0=s[i:i+2]\n i+=2... | ['Runtime Error', 'Accepted'] | ['s844384632', 's107888695'] | [9304.0, 9248.0] | [130.0, 88.0] | [205, 194] |
p02939 | u688126754 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['\nS = input()\n\nSi = S[:1]\nSi = ""\n\ncount = 1\ni = 1\nfor j in range(2, len(S)+1):\n if Si == S[i:j]:\n pass\n else:\n Si = S[i:j]\n i = j\n count += 1\nprint(count)', '\nS = input()\n\nSi = S[:1]\n\ncount = 1\ni = 1\nfor j in range(2, len(S)+1):\n if Si == S[i:j]:\n pa... | ['Wrong Answer', 'Accepted'] | ['s267507284', 's213651367'] | [3500.0, 3500.0] | [112.0, 99.0] | [188, 180] |
p02939 | u688375653 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['input_data = []\ndata = input()\n\n\nmemory="first"\ni=0\nk=0\n\n\nif data[-1]==data[-2]:\n k+=1\n data=data[:-2]\n\nmax_len=len(data)\nwhile max_len!=i:\n if data[i] == memory:\n memory=data[i:i+2]\n print(memory)\n i+=2\n else:\n memory=data[i]\n i+=1 \n k+=1... | ['Runtime Error', 'Accepted'] | ['s628779276', 's874447879'] | [3960.0, 3500.0] | [116.0, 91.0] | [344, 386] |
p02939 | u688382286 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\nt = ""\nans = 0\nfor i in range(len(s)):\n t += s[i]\n #print(t)\n if i+1 = len(s) or i+1+len(t) > len(s):\n ans += 1\n t = ""\n elif s[i+1:i+1+len(t)] != t:\n ans += 1\n t = ""\n\nprint(ans)', 's = input()\nt = ""\nans = 0\nfor i in range(len(s)):\n t += s[i]\n... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s015667509', 's654034165', 's711515057', 's722266977'] | [2940.0, 3500.0, 3500.0, 3500.0] | [17.0, 842.0, 803.0, 101.0] | [231, 328, 232, 324] |
p02939 | u691018832 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["import sys\ninput = sys.stdin.readline\n\nn = int(input())\nw = list(input().split())\nans = ['TAKAHASHIKUN', 'Takahashikun', 'takahashikun']\ncnt = 0\nw[n - 1] = w[n - 1].rstrip('.')\nfor i in range(n):\n if len(w[i]) == 12 and w[i] in ans:\n cnt += 1\n\nprint(cnt)\n", "s = input()\nmemo = ''\nlen_s = len(... | ['Runtime Error', 'Accepted'] | ['s903069407', 's218726442'] | [3500.0, 3500.0] | [21.0, 96.0] | [265, 315] |
p02939 | u699765883 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = input()\na = ""\nstock = ""\ndata = []\n\nfor i in S:\n a = a + i\n if a != stock:\n stock = a\n data.append(a)\n a = ""\ncount = len(data)\n\n\nif a == stock:\n i = 1\n data.append(a)\n check = 1\n c = 0\n while True:\n word = ""\n a = ""\n c = 0\n ... | ['Wrong Answer', 'Accepted'] | ['s957585035', 's909459640'] | [8296.0, 8296.0] | [73.0, 74.0] | [1064, 1387] |
p02939 | u712397093 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = str(input())\n\nj = 0\ncount = len(s)\ns = [_ for _ in s]\nfor i in range(0, len(s)-1):\n if j+2 <= len(s)-1:\n if s[j] == s[j+1]:\n j = j+3\n count -= 1\n else:\n continue\n \nprint(count)', 's = str(input())\n\ns = [_ for _ in s]\nfor i in range(0, len(s)-1):... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s266471559', 's633686565', 's675183299', 's855496855', 's903598198'] | [5096.0, 138620.0, 138532.0, 138576.0, 5096.0] | [90.0, 1704.0, 1657.0, 1750.0, 107.0] | [233, 275, 243, 281, 255] |
p02939 | u714878632 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\n N = len(s)\n ans = 0\n\n tmp = ""\n i = 0\n while i < N:\nif not tmp == s[i]:\ntmp = s[i]\n ans += 1\n else:\ntmp = ""\n i += 1\n if not i == N:\nans += 1\n i += 1\n # print(tmp, ans, i)\n\n print(ans)', 'def main():\n s = input()\n N = len(s)\n ans = 0\n\n tmp = ""\n ... | ['Runtime Error', 'Accepted'] | ['s717662080', 's340473176'] | [2940.0, 3628.0] | [18.0, 54.0] | [219, 385] |
p02939 | u727148417 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\nN = len(s)\ni = 0\ncount = 0\nwhile i < N-1:\n if i == 0:\n word = s[i]\n i += 1\n count += 1\n last = 1\n if last == 1:\n if s[i-1] != s[i]:\n word = s[i]\n i += 1\n count += 1\n last = 1\n elif i != N-2:\n ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s154707143', 's387735487', 's548440247', 's057764700'] | [5192.0, 134712.0, 5196.0, 3500.0] | [351.0, 204.0, 328.0, 126.0] | [640, 398, 439, 411] |
p02939 | u741397536 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = input()\nS = list(S)\n\nans = 1\npre = S[0]\nc = 1\nprint(S[len(S)-1])\nwhile 1:\n if c == len(S):\n break\n if c == len(S)-1:\n if S[c] == pre:\n break\n else:\n ans += 1\n break\n\n if S[c] == pre:\n pre = S[c]+S[c+1]\n ans += 1\n ... | ['Wrong Answer', 'Accepted'] | ['s121963457', 's850495357'] | [4840.0, 4840.0] | [115.0, 125.0] | [381, 362] |
p02939 | u745514010 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['string = input()\nbefore = ""\nflg = False\nans = 0\nfor i, s in enumerate(string):\n if flg:\n flg = False\n before = s\n continue\n elif s == before:\n if i == len(string) - 1:\n break\n flg = True\n ans += 1\n before = s\nprint(ans)', 's = input()\nl = len(... | ['Wrong Answer', 'Accepted'] | ['s041794541', 's810852336'] | [3500.0, 36384.0] | [76.0, 284.0] | [278, 261] |
p02939 | u758815106 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = input()\n\nres = 0\ntmp = ""\nlast = ""\n\nfor s in S:\n tmp += s\n if tmp == last:\n continue\n\n print(tmp)\n last = tmp\n tmp = ""\n res += 1\n\nprint(res)', 'S = input()\n\nt = 0\nlast = ""\nres = 0\n\nwhile t < len(S):\n if S[t] == last:\n res += 1\n t += 2\n else... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s252157352', 's584843992', 's584089960'] | [9200.0, 9328.0, 9176.0] | [107.0, 79.0, 67.0] | [171, 162, 156] |
p02939 | u782930273 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = input()\ni = 0\nparts = [S[0]]\nparts_append = parts.append\nwhile i < len(S) - 1:\n print(parts[-1], S[i + 1])\n if S[i + 1] == parts[-1]:\n parts_append(S[i + 1:i + 3])\n i += 2\n else:\n parts_append(S[i + 1])\n i += 1\n\nprint(len(parts) - (1 if i == len(S) else 0))', 'S =... | ['Wrong Answer', 'Accepted'] | ['s595760737', 's550599052'] | [9516.0, 8068.0] | [307.0, 107.0] | [298, 267] |
p02939 | u790922244 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['def main():\n S=input()\n \n ans = [S[0]]\n c = ""\n for i in range(1, len(S)):\n c += S[i]\n if ans[-1] != c:\n ans.append(c)\n c = ""\n\n print(ans)\n print(len(ans)) \n\nif __name__ == \'__main__\':\n main()', 'def main():\n S=input()\n \n ans... | ['Wrong Answer', 'Accepted'] | ['s245025936', 's993960052'] | [10236.0, 8068.0] | [64.0, 55.0] | [256, 240] |
p02939 | u798818115 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['# coding: utf-8\n# Your code here!\nS=list(input())[::-1]\n\ncount=0\ntemp=[]\npre=[]\nwhile len(S)>3:\n temp.append(S.pop(-1))\n if temp==pre:\n temp.append(S.pop(-1))\n pre.clear()\n pre+=temp\n temp.clear()\n count+=1\n\nif len(S)==3:\n print(S[10])\n if pre[-1]==S[2] or S[2]==S[1] o... | ['Runtime Error', 'Accepted'] | ['s983343672', 's877068534'] | [6308.0, 6308.0] | [186.0, 187.0] | [468, 476] |
p02939 | u802963389 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\ncnt = 0\np = ""\nfor i in s:\n if p != i:\n p = i\n cnt += 1\n else:\n p += i\n\nbcnt = 0\nbp = s[0]\nfor j in s:\n if bp != j:\n bp = j\n bcnt += 1\n else:\n bp += i\nprint(cnt, bcnt)\nprint(max(cnt,bcnt))', 's = input()\ncnt = 0\np = ""\nfor i in s:\n if p != i:\n p = i\n ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s619896901', 's824170442', 's848033243', 's752239170'] | [3500.0, 3500.0, 3500.0, 3500.0] | [97.0, 54.0, 97.0, 92.0] | [223, 105, 224, 242] |
p02939 | u811068179 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = list(input())\nn = len(s)\nfor i in range(0,n-1):\n\tif i == n-2:\n\t\tif s[i] == s[i+1]:\n\t\t\tn-=1\n\t\tbreak\n\tif s[i]==s[i+1]:\n\t\ts[i+1]+=s[i+2]\n\t\ts.pop(i+2)\n\t\tn-=1\nprint(n)8', 's = list(input())\nans = 0\nlength = 1\nSi = s[0]\nloop = [0]\nfor i in loop:\n\tSi_1 = ""\n\tfor j in range(0,length):\n... | ['Runtime Error', 'Accepted'] | ['s390930011', 's072422995'] | [2940.0, 12604.0] | [17.0, 299.0] | [167, 327] |
p02939 | u844426556 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['string = input()\ntemp = ""\nlast = ""\ncount = 0\nfor s in string:\n temp += s\n if last != s:\n count += 1\n last = temp\n temp = s\n\nprint(count)\n', 'string = input()\ntemp = ""\ncount = 0\nfor s in string:\n if temp == "":\n temp = s\n elif temp != s:\n count += 1\n temp = ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s432052189', 's497500979', 's499353110', 's090776950'] | [3500.0, 3500.0, 3500.0, 3500.0] | [81.0, 59.0, 77.0, 68.0] | [166, 167, 196, 262] |
p02939 | u844902298 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = list(input())\ncount = 0\ncheck = 0\ntem = str()\n\nfor i in range(0,len(s)):\n if check >0:\n check -= 1\n count += 1\n if check != 0:\n count -= 1\n continue\n if tem == "" or tem != s[i] :\n count += 1\n print(tem)\n tem = s[i]\n else:\n check... | ['Wrong Answer', 'Accepted'] | ['s564204273', 's292922607'] | [5664.0, 4840.0] | [198.0, 107.0] | [362, 319] |
p02939 | u858670323 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['from collections import defaultdict\nd = defaultdict(bool,False)\ns = str(input().rstrip())\nl=0\nr=1\nwhile(r<len(s)):\n\tif(d[s[l:r]]==False):\n d[s[l:r]]=True\n l=r\n r+=1 \n else:\n r+=1\n\nans=0\nfor key,val in d.items():\n if(val==True):ans+=1\n\nprint(ans)', "s = str(input().rstrip... | ['Runtime Error', 'Accepted'] | ['s373349289', 's026385456'] | [2940.0, 8312.0] | [17.0, 139.0] | [274, 183] |
p02939 | u860002137 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = input()\n\nlast = S[0]\nans = 1\ncnt = 1\n\nwhile cnt < len(S):\n if len(last)==1:\n if last != S[cnt]:\n last = S[cnt]\n ans += 1\n cnt += 1\n else:\n last = S[cnt:cnt+2]\n ans += 1\n cnt += 2\n if len(last)==2:\n last =... | ['Runtime Error', 'Accepted'] | ['s688966191', 's790390990'] | [3500.0, 8296.0] | [118.0, 125.0] | [354, 303] |
p02939 | u867604473 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["S=input()\nk=0\ns=''\nex_s=''\npos=0\n\nfor i in range(len(S)+1):\n if pos > i:\n print('i, pos : ',i,pos)\n continue\n if pos > len(S):\n break\n \n for j in range(1,len(S)-i): \n s=S[i:i+j] \n print(i,j)\n if ex_s==s:\n print('ex_s, s: ',ex_s,s)\n continue\n else:\n \... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s075067194', 's545627868', 's611786490', 's382565927'] | [9468.0, 3500.0, 9132.0, 3500.0] | [961.0, 263.0, 1028.0, 247.0] | [519, 300, 530, 548] |
p02939 | u893063840 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\n\nformer = s[0]\nk = 1\nidx = 1\nwhile idx < len(s):\n if s[idx] != former:\n former = s[idx]\n idx += 1\n else:\n former = s[idx:idx+2]\n idx += 2\n k += 1\n\nprint(k)\n', 's = input()\n\nprev = ""\nlets = ""\nans = 0\nfor e in s:\n lets += e\n if lets != prev:... | ['Wrong Answer', 'Accepted'] | ['s019260527', 's677626839'] | [3500.0, 3500.0] | [104.0, 69.0] | [205, 155] |
p02939 | u896741788 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['def f(s,pre):\n if s=="":return 0\n if pre==s[0]:\n return f(s[2:],s[:2])+1\n else:return f(s[1:],s[0])+1\nprint(f(input(),""))', 'a=input()\nl=set()\ns=""\nfor i in list(a):\n s+=i\n if s not in l:\n l.append(s)\n s=""\n else:continue\nprint(len(l))', 's=input()\nif len(s)<=2:\n print(len(set(list(... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s038482010', 's113353716', 's796646606'] | [198596.0, 4840.0, 11240.0] | [164.0, 20.0, 111.0] | [128, 119, 223] |
p02939 | u898999125 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s=input()\ncount=1\nps=s[0]\ni=1\nwhile i<len(s):\n if s[i]!=ps:\n count+=1\n ps=s[i]\n i+=1\n elif i==len(s)-1:\n break\n else:\n count+=1\n ps=s[i:i+2]\n i+=2\n print(ps)\nprint(count)', 's=input()\ncount=1\nps=s[0]\ni=1\nwhile i<len(s):\n if s[i]!=ps:\n count+=1\n ps=s[i]\n i+=1\... | ['Wrong Answer', 'Accepted'] | ['s435900772', 's284158155'] | [4212.0, 3500.0] | [197.0, 92.0] | [195, 183] |
p02939 | u901447859 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s=input()\n\nmax_len=0\ntmp=""\narr=[s[0]]\nfor s_ in s[1:]:\n tmp+=s_\n if tmp != arr[-1]:\n arr.append(tmp)\n tmp=\'\'\nprint(arr)\nmax_len=max(max_len,len(arr))\n\nprint(max_len)', 's=input()\n \ntmp=""\nlast=""\ncnt=1\nfor s_ in s:\n tmp+=s_\n if tmp != last:\n last=tmp\n tmp=\'\'\n cnt+=1\npri... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s014348092', 's045379092', 's400372151'] | [10364.0, 3500.0, 3500.0] | [90.0, 65.0, 67.0] | [174, 119, 119] |
p02939 | u905582793 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['import sys\ninput=sys.stdin.readline\ns=input()\nn=len(s)\nans=0\nwhile s:\n if len(s)==n:\n si=s[0]\n s=s[1:]\n else:\n if si==s[0]:\n if len(s)==1:\n break\n else:\n si=s[:2]\n s=s[2:]\n else:\n si=s[0]\n s=s[1:]\n ans+=1\nprint(ans)', 's=input()\nn=len(s)\nan... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s787172540', 's936279428', 's659094146'] | [3500.0, 3500.0, 3500.0] | [1237.0, 1211.0, 1230.0] | [271, 226, 235] |
p02939 | u906117132 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s=input()\nans=0\nk=0\nk2=[]\nk1=[]\nfor i in range(len(s)-1):\n if s[i]!=s[i+1] :\n k1.append(s[k:i+1])\n print(k1[0])\n if k1!=k2:\n if k2:\n del k2[0]\n k2.append(k1[0])\n del k1[0]\n ans+=1\n k=i+1\n \n \n \nif... | ['Wrong Answer', 'Accepted'] | ['s276285277', 's736636330'] | [4344.0, 3500.0] | [314.0, 220.0] | [371, 306] |
p02939 | u909991537 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["S = input()\nN = len(S)\n\nbef = ''\ni = 0\ncount = 0\nwhile i < N:\n s = S[i]\n while s == bef:\n i += 1\n s += S[i]\n \n bef = s\n i += 1\n count += 1\n \nprint(count)\n \n ", "S = input()\nN = len(S)\n\nbef = ''\ni = 0\ncount = 0\nwhile i < N:\n s = S[i]\n while s == bef:\n i += 1\n if i >... | ['Runtime Error', 'Accepted'] | ['s277950865', 's907203524'] | [3500.0, 3500.0] | [94.0, 94.0] | [174, 233] |
p02939 | u923270446 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s=input()\nc=0\ns2=""\ns3=""\nfor i in s:\n s3+=i\n if s2!=s3:\n c+=1\n s2+=s3\n s3=""\nprint(c)', 's=input()\nc=0\ns2=""\ns3=""\nfor i in s:\n s3+=i\n if s2!=s3:\n c+=1\n s2=s3\n s3=""\nprint(c)'] | ['Wrong Answer', 'Accepted'] | ['s634161851', 's589143102'] | [3500.0, 3500.0] | [92.0, 67.0] | [89, 88] |
p02939 | u927357863 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['# -*- coding: utf-8 -*-\nS = input()\nN = len(S)\ncnt = 1\ni = 0\n\nwhile i < N - 1:\n\n\tif S[i] != S[i + 1]:\n\t\tcnt += 1\n\t\ti += 1\n\telse:\n\t\tcnt += 2\n\t\ti += 3\n\n\nprint(cnt)\t', 'S = input()\ndp = [0] * (len(S) + 1)\ndp[1] = 1\n\nif S[0] == S[1]:\n\tdp[2] = 1\nelse:\n\tdp[2] = 2\n\nfor i in range(3, len... | ['Wrong Answer', 'Accepted'] | ['s546831068', 's235112995'] | [3500.0, 11240.0] | [90.0, 115.0] | [162, 219] |
p02939 | u936985471 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s=input()\nseen=set()\ni=0\nans=0\nwhile i<len(s):\n for j in range(i+1,len(s)):\n if s[i:j] not in seen:\n if s[j:] in seen:\n continue\n seen.add(s[i:j])\n i=j\n ans+=1\nprint(ans)\n ', 's=input()\ncur=""\ni=0\nans=0\nwhile i<len(s):\n for j in range(i+1,len(s)):\n if s[i:j]!... | ['Time Limit Exceeded', 'Time Limit Exceeded', 'Wrong Answer', 'Accepted'] | ['s189281307', 's492950980', 's881357982', 's991700920'] | [7268.0, 3500.0, 9832.0, 39524.0] | [2104.0, 2107.0, 2104.0, 516.0] | [208, 185, 299, 414] |
p02939 | u943057856 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S=input()\ntmp=S[0]\ni=1\nans=1\nwhile i<len(S):\n print(S[i],tmp)\n if S[i]!=tmp:\n ans+=1\n tmp=S[i]\n i+=1\n else:\n ans+=1\n tmp=S[i:i+2]\n i+=2\nif len(S)!=1:\n if S[-2]==S[-1] and tmp!=S[-2:]:\n ans-=1\nprint(ans)\n\n\n\n\n\n\n\n', 'S=input()\ntmp=S[0... | ['Wrong Answer', 'Accepted'] | ['s899010332', 's046464323'] | [8920.0, 9212.0] | [165.0, 87.0] | [271, 274] |
p02939 | u945181840 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = list(input())\nl = [S.pop()]\n\nwhile S:\n if S[-1] != l[-1]:\n l.append(S.pop())\n else:\n if len(S) == 1:\n break\n else:\n a = S.pop()\n b = S.pop()\n l.append(b + a)\n print(l)\n\nprint(len(l))', 'S = list(input())\nl = [S.pop()]\n\nwhi... | ['Runtime Error', 'Accepted'] | ['s354542973', 's194666629'] | [135972.0, 7872.0] | [1698.0, 85.0] | [260, 247] |
p02939 | u969190727 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['import sys\ninput = sys.stdin.readline\ns=input()\nn=len(s)\nAns=[]\nc=0\nprev=None\nwhile c<=n-3:\n s1,s2,s3=s[c],s[c+1],s[c+2]\n if s1!=prev:\n Ans.append(c+1)\n c+=1\n prev=s1\n else:\n Ans.append(c+2)\n c+=2\n prev=s1+s2\nans=len(Ans)\nif n==1:\n print(1)\nelif n==2:\n if s[0]!=s[1]:\n p... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s782021046', 's797476067', 's824349578', 's030336734'] | [10920.0, 10920.0, 10924.0, 11112.0] | [145.0, 148.0, 138.0, 142.0] | [687, 693, 687, 649] |
p02939 | u970809473 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\nres = 1\nflg = 0\ni = 1\nwhile i < len(s)-2:\n if s[i] == s[i-1]:\n i += 3\n res += 2\n else:\n res += 1\n i += 1\nif i == len(s):\n print(res)\nelif i == len(s)-1:\n if s[-1] == s[-2]:\n print(res)\n else:\n print(res+1)\nelif i == len(s)-2:\n if s[-1] == s[-2] == s[-3]:\n pri... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s423730511', 's511375882', 's798815542'] | [3500.0, 3500.0, 3500.0] | [89.0, 87.0, 91.0] | [332, 188, 385] |
p02939 | u970899068 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s=input()\n\ncount=1\nk=0\n\nfor i in range(len(s)-1):\n if s[i+k]==s[i+k+1]:\n k+=2\n count+=2\n if i+k>=len(s)-2:\n print(count)\n exit()\n else:\n count+=1\n if i+k>=len(s)-2:\n print(count)\n exit()', 's=input()\ns=str(0)+s\ncoun... | ['Wrong Answer', 'Accepted'] | ['s468239261', 's346538824'] | [3500.0, 3500.0] | [105.0, 117.0] | [271, 423] |
p02939 | u972658925 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['s = input()\n\ni = 0\nlst = []\nfor j in range(1,len(s)+1):\n if lst[-1] != s[i:j]:\n lst.append(s[i:j])\n i = j\n\nprint(len(lst))', 's = input()\n\ni = 0\nlst = [""]\nfor j in range(1,len(s)+1):\n if lst[-1] != s[i:j]:\n lst.append(s[i:j])\n i = j\n\nprint(len(lst)-1)'] | ['Runtime Error', 'Accepted'] | ['s917931244', 's878652557'] | [9304.0, 14284.0] | [24.0, 86.0] | [139, 143] |
p02939 | u975116284 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ["s = input()\n\ndp = [[[0, ' '], [0, ' ']], [[1, s[1]], [1, ' '+s[1]]]]\nfor i in range(1, len(s)):\n if s[i-1:i+1] == dp[-2][1][1]:\n ndp1 = [dp[-2][0][0]+1, s[i-1:i+1]]\n else:\n ndp1 = [max(dp[-2][0][0], dp[-2][1][0])+1, s[i-1:i+1]]\n if s[i] == dp[-1][0][1]:\n ndp0 = [dp[-1][1][0]+1,... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s333939972', 's688635084', 's333787332'] | [85396.0, 91660.0, 85416.0] | [700.0, 1346.0, 696.0] | [458, 497, 454] |
p02939 | u975658594 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = input()\nprevious_c = S[0]\npresent_c = ""\ntotal_count = 1\nfor c in S[1:]:\n present_c += c\n if present_c != previous_c:\n print(previous_c)\n total_count += 1\n previous_c = present_c\n present_c = ""\n\n else:\n pass\nprint(total_count)\n', 'S = input()\nprevious_c... | ['Wrong Answer', 'Accepted'] | ['s276834020', 's709635538'] | [4464.0, 3500.0] | [171.0, 72.0] | [276, 250] |
p02939 | u981931040 | 2,000 | 1,048,576 | Given is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition: * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1). Here S_1S_2...S_K represents the concatenation of S_1,S_2,.... | ['S = input()\ncount = 0\nstart = 0\nend = 1\nhold_value = ""\nwhile end <= len(S):\n if hold_value == S[start:end]:\n end += 1\n else:\n hold_value = S[start:end]\n print(hold_value)\n start = end\n end += 1\n count += 1\nprint(count)', 'S = list(input())\nS = S[::-1]\ne... | ['Wrong Answer', 'Accepted'] | ['s493402165', 's846001643'] | [4208.0, 27528.0] | [216.0, 182.0] | [267, 231] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.