Titmus upsets Ledecky at swim titles