Working solution for DecodeWays