Back
Close

I just peel the stickers off!

Statement

 Goal

Can a Rubik's cube be solved by Restickering™?

A popular method to pretend you can solve the Rubik's cube when no one's watching is to peel the stickers off and glue them back into place. It's not a very good method, as it tends to damage the stickers irreparably, but from a theoretical point of view it does the job.

Feliks has left his scrambled cube on the table for only a few minutes, but as he comes back from his break, he notices an evil grin on Lucas's face. Has Lucas been messing around with the cube and spare stickers in a way that makes it unsolvable using the Restickering™ method? Help Feliks by telling him whether or not he can peel and glue the stickers back into place.

You are given a cube state in pattern format. A solved cube looks like this:

UUU
UUU
UUU

LLL FFF RRR BBB
LLL FFF RRR BBB
LLL FFF RRR BBB

DDD
DDD
DDD

Letters ULFRBD mean “this sticker belongs on the Up/‌Left/‌Front/‌Right/‌Back/‌Down face”.

A monochrome cube, e.g. with only U stickers, is obviously unsolvable using the Restickering™ method.

A cube where an R′ move (right face counterclockwise quarter turn, in standard notation) has been applied is solvable using the Restickering™ method and looks like the example below.
Input
11 lines (including 2 blank): a cube pattern
Output
SOLVABLE if it is possible to peel the stickers off and glue them back in a solved cube.
UNSOLVABLE otherwise.
Constraints
Apart from the stickering, all cubes are standard 3×3×3 Rubik's cubes.
Only valid sticker colors are provided.
Example
Input
    UUB
    UUB
    UUB

LLL FFU RRR DBB
LLL FFU RRR DBB
LLL FFU RRR DBB

    DDF
    DDF
    DDF
Output
SOLVABLE

Game modes
Fastest, Shortest, Reverse

Test cases
R′ Test
Input
UUB UUB UUB LLL FFU RRR DBB LLL FFU RRR DBB LLL FFU RRR DBB DDF DDF DDF
Output
SOLVABLE

L Validator
Input
BUU BUU BUU LLL UFF RRR BBD LLL UFF RRR BBD LLL UFF RRR BBD FDD FDD FDD
Output
SOLVABLE

Solved Test
Input
UUU UUU UUU LLL FFF RRR BBB LLL FFF RRR BBB LLL FFF RRR BBB DDD DDD DDD
Output
SOLVABLE

x2 Validator
Input
DDD DDD DDD LLL BBB RRR FFF LLL BBB RRR FFF LLL BBB RRR FFF UUU UUU UUU
Output
SOLVABLE

Pure White Test
Input
UUU UUU UUU UUU UUU UUU UUU UUU UUU UUU UUU UUU UUU UUU UUU UUU UUU UUU
Output
UNSOLVABLE

Pure Yellow Validator
Input
DDD DDD DDD DDD DDD DDD DDD DDD DDD DDD DDD DDD DDD DDD DDD DDD DDD DDD
Output
UNSOLVABLE

L2 D R′ D′ F′ D′ R D′ R2 F2 Test
Input
DUD DUU BDL LLL UFF ULR FBF LLR BFF URB DBF FRD BUU BFB DBR LRR DDR ULR
Output
SOLVABLE

M2 E2 S2 Validator
Input
UDU DUD UDU LRL FBF RLR BFB RLR BFB LRL FBF LRL FBF RLR BFB DUD UDU DUD
Output
SOLVABLE

UF edge flip Test
Input
UUU UUU UFU LLL FUF RRR BBB LLL FFF RRR BBB LLL FFF RRR BBB DDD DDD DDD
Output
SOLVABLE

UF edge flip on L2 D R′ D′ F′ D′ R D′ R2 F2 Validator
Input
DUD DUU BFL LLL UDF ULR FBF LLR BFF URB DBF FRD BUU BFB DBR LRR DDR ULR
Output
SOLVABLE

UFR corner twist Test
Input
UUU UUU UUF LLL FFR URR BBB LLL FFF RRR BBB LLL FFF RRR BBB DDD DDD DDD
Output
SOLVABLE

UFR corner twist on L2 D R′ D′ F′ D′ R D′ R2 F2 Validator
Input
DUD DUU BDF LLL UFU LLR FBF LLR BFF URB DBF FRD BUU BFB DBR LRR DDR ULR
Output
SOLVABLE

Random stickers Test
Input
LRD DFR RBD ULF LRB DBD LLB RLL BUU BFD FFU BDR URL UDF RFL FBU LRU DFU
Output
UNSOLVABLE

Other random stickers Validator
Input
UFD URL UBF LFR FDU LRU RDB UFF DFB UUB LLR BLL DBD BRL FLU DBR RFD DRL
Output
UNSOLVABLE

More random stickers Test
Input
BDL DBL LUR BFR BBD LUFDUR UBR RRD DLDFUR RBF FUU FRFBFD UBF LLD LUR
Output
UNSOLVABLE

More other random stickers Validator
Input
UUR RBL FDB LLU DBD URD LFU UFR FDB ULB DBR FFL RLF BLB BLD LUF FRD URR
Output
UNSOLVABLE

Solution language

Solution

Stub generator input