password=gets.chomp def capslock(str) ret = '' for num in 0..str.length ret += str[num, 1].swapcase end return ret end puts capslock(password)