Skip to main content
deleted 4 characters in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

Python 3, 196 190186 bytes

F="><> >><> ><>> ><<<> <>< <><< <<>< <>>>< ,<..>,".split()
def g(s):
 if s in F:return[s]
 for f in F:
  i=len(f)
  if f==s[:i]and g(s[i:]):return[f]+g(s[i:])
R=g(input())or[]
if R:print(*R)

Simple recursion. g either returns a list of parsed fish, or None if the input string is unparseable.

Python 3, 196 190 bytes

F="><> >><> ><>> ><<<> <>< <><< <<>< <>>>< ,<..>,".split()
def g(s):
 if s in F:return[s]
 for f in F:
  i=len(f)
  if f==s[:i]and g(s[i:]):return[f]+g(s[i:])
R=g(input())or[]
if R:print(*R)

Simple recursion. g either returns a list of parsed fish, or None if the input string is unparseable.

Python 3, 196 186 bytes

F="><> >><> ><>> ><<<> <>< <><< <<>< <>>>< ,<..>,".split()
def g(s):
 if s in F:return[s]
 for f in F:
  i=len(f)
  if f==s[:i]and g(s[i:]):return[f]+g(s[i:])
R=g(input())
if R:print(*R)

Simple recursion. g either returns a list of parsed fish, or None if the input string is unparseable.

deleted 1 character in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

Python 3, 197196 190 bytes

F="><> >><> ><>> ><<<> <>< <><< <<>< <>>>< ,<..>,".split()
def g(s):
 if s in F:return[s]
 for f in F:
  i=len(f)
  if s[f==s[:i]==f andi]and g(s[i:]):return[f]+g(s[i:])
 return[]
R=g(input())or[]
if R:print(*R)

Simple recursion. g either returns a list of parsed fish, or None if the input string is unparseable.

Python 3, 197 bytes

F="><> >><> ><>> ><<<> <>< <><< <<>< <>>>< ,<..>,".split()
def g(s):
 if s in F:return[s]
 for f in F:
  i=len(f)
  if s[:i]==f and g(s[i:]):return[f]+g(s[i:])
 return[]
R=g(input())
if R:print(*R)

Simple recursion.

Python 3, 196 190 bytes

F="><> >><> ><>> ><<<> <>< <><< <<>< <>>>< ,<..>,".split()
def g(s):
 if s in F:return[s]
 for f in F:
  i=len(f)
  if f==s[:i]and g(s[i:]):return[f]+g(s[i:])
R=g(input())or[]
if R:print(*R)

Simple recursion. g either returns a list of parsed fish, or None if the input string is unparseable.

Post Undeleted by Sp3000
Post Deleted by Sp3000
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

Python 3, 197 bytes

F="><> >><> ><>> ><<<> <>< <><< <<>< <>>>< ,<..>,".split()
def g(s):
 if s in F:return[s]
 for f in F:
  i=len(f)
  if s[:i]==f and g(s[i:]):return[f]+g(s[i:])
 return[]
R=g(input())
if R:print(*R)

Simple recursion.