CSES - DatatÃ¤hti 2022 alku - Results
 Task: Ositus (Partitioning) Sender: parasdata Submission time: 2021-10-11 12:33:29 Language: CPython3 Status: READY Result: 0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#1ACCEPTED0.02 s1, 2, 3details
#20.03 s1, 2, 3details
#30.03 s1, 2, 3details
#40.03 s1, 2, 3details
#5--2, 3details
#6--3details
#7--3details

### Code

```vastaus = 0

def next1(listt):
listt[-1] += 1
listt[-2] -= 1
print(listt)
check_group(listt)

def next2(listt):
listt.append(1)
listt[-2] -= 1
print(listt)
check_group(listt)

def algorithm(listt):
while listt[-1] >= 2:
next2(listt)
while listt[-2] != 1:
next1(listt)
if listt[-1] >= 2 and listt[-2] != 1:
copy2 = listt.copy()
algorithm(copy2)

def check_group(group):
global vastaus
valid = True
new_group = []
i = 0
for size in group:
if size == 0:
return
sett = ""
while size > 0:
sett += text[i]
size -= 1
i += 1
check = list(sett)
if len(set(check)) < len(check):
valid = False
new_group.append(sett)
if valid == True:
vastaus += 1

text = list(str(input()))
arvo = len(text)
if arvo == 1:
vastaus = 1
elif arvo == 2:
if len(set(text)) < arvo:
vastaus = 1
else:
vastaus = 2
else:
listt = [arvo - 1, 1]

check_group(listt)

next1(listt)

copy = listt.copy()

while True:
algorithm(listt)
listt = copy.copy()
next1(listt)
copy = listt.copy()
if listt[0] == 0:
break

print(vastaus % (10**9 + 7))
```

### Test details

#### Test 1

Group: 1, 2, 3

Verdict: ACCEPTED

input
a

correct output
1

user output
1

Group: 1, 2, 3

Verdict:

input
abcdefghij

correct output
512

user output
[8, 2]
[8, 1, 1]
[7, 3]
[7, 2, 1]
[7, 1, 2]
...

Group: 1, 2, 3

Verdict:

input
abcabaacbc

correct output
120

user output
[8, 2]
[8, 1, 1]
[7, 3]
[7, 2, 1]
[7, 1, 2]
...

Group: 1, 2, 3

Verdict:

input
aaxxxxxxaa

correct output
4

user output
[8, 2]
[8, 1, 1]
[7, 3]
[7, 2, 1]
[7, 1, 2]
...

#### Test 5

Group: 2, 3

Verdict:

input
mfyzvoxmppoxcvktmcjkryyocfweub...

correct output
643221148

user output
(empty)

#### Test 6

Group: 3

Verdict:

input
weinscqmmpgbrlboocvtbptgbahmwv...

correct output
831644159

user output
(empty)

#### Test 7

Group: 3

Verdict:

input
sxaoxcyrjoeieyinaqxwukgzdnhhsw...

correct output
816016015

user output
(empty)