Fixed bug in function 1, input may have mixed cases