#!/usr/bin/env python
import sys
import argparse
def getinput():
	if sys.version_info[0]>2:
		return input()
	else:
		return raw_input()
parser = argparse.ArgumentParser(description='Converts text to robberers lang')
parser.add_argument("-f","--file",help="use a file as input")
parser.add_argument("-o","--output",help="write to a file")
parser.add_argument("-r","--reverse",help="From robbers lang to normal",action='store_true')
parser.add_argument("-help","--showhelp",help="Displays help",action='store_true')
args = vars(parser.parse_args())

if args["showhelp"]:
	print( "---RobbersLang---")
	print ("The robber language is a language game popular in Sweaden")
	print ("Every consonant is replaced with consonant + 'o' + consonant")
	print ("Read more at http://bit.ly/1WJ6b77")
	print ("-help/--showhelp to show this help")
	print ("-f/--file <filename> to read from a file")
	print ("-o/--output <filename> to write to a file")
	print ("-r/--reverse to go from robber language to normal")
	sys.exit()
if args["file"]!=None:
	f=open(args["file"],"r")
	text=f.read()
	f.close()
else:
	text=getinput()

kons="B,C,D,F,G,H,J,K,L,M,N,P,Q,R,S,T,V,W,X,Z".split(",")
kons.extend([k.lower() for k in kons])

if not args["reverse"]:
	for k in kons:
		text=text.replace(k,k+"o"+k)
else:
	for k in kons:
		text=text.replace(k+"o"+k,k)	
if args["output"]!=None:
	f=open(args["output"],"w")
	f.write(text)
	f.close()
else:
	print (text)



