Actually, you were putting your else if(UC==0) return something.
This will definitely behave very different as your count is initialized to 0 and whenever it'll not find first upper case it'll throw...