# CPSC 115 
# In class example
# Converts words into their pig latin versions


def findFirstVowel(word):
	'''Returns the first vowel in word or -1 if no vowels'''
	i = 0
	while i < len(word):
		if word[i] == 'a' or word[i] == 'e' or word[i] =='i' or word[i] == 'o' or word[i] == 'u':
			return i
		i = i + 1
	return -1

#print findFirstVowel('bring')
#print findFirstVowel('any')
#print findFirstVowel('zbgny')

def pigLatin(word):
	'''Converts word to Pig Latin and returns the result'''
	pigword = ""
	firstvowel = findFirstVowel(word)
	if firstvowel == 0:   # word begins with a vowel
		pigword = word + 'yay'
	else:
		pigword = word[firstvowel:] +  word[0:firstvowel] + 'ay'
	return pigword

print 'Pig latin of bring = ', pigLatin('bring')
print pigLatin('any')
print pigLatin('alpha')
print pigLatin('zbgny')
print pigLatin('string')
