You are asked to ensure that the first and last names of people begin with a capital letter in their passports. For example, alison heck should be capitalised correctly as Alison Heck. 

$\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\$

Given a full name, your task is to capitalize the name appropriately.

Input Format

A single line of input containing the full name, $\mbox{S}$.

Constraints

$0<len(S)<1000$  
The string consists of alphanumeric characters and spaces.  

Note: in a word only the first character is capitalized. Example 12abc when capitalized remains 12abc. 

Output Format

Print the capitalized string, $\mbox{S}$.

Sample Input
chris alan

Sample Output
Chris Alan

Source: hackerrank | Difficulty: EASY
Tags: String algorithms


Solutions:
def getCap(s):
	s = ' ' + s
	r = ''
	for i in range(1, len(s)):
		if s[i - 1] == ' ' and s[i] != ' ':
			r += s[i].upper()
		else:
			r += s[i]
	return r
s = input()
print(getCap(s))


myString = input().strip()
myList = myString.split()
outList = list()
k = 0
state = 0
for i in range(0, len(myString)):
	if myString[i] != ' ' and state == 0:
		outList.append(myString[i].capitalize())
		state = 1
	elif myString[i] != ' ' and state == 1:
		outList.append(myString[i])
	else:
		outList.append(myString[i])
		state = 0
print(''.join(outList))


print(' '.join(map(lambda s: s.capitalize(), input().split(' '))))


kata = input()
kon = True
for i in range(len(kata)):
	if kon == True:
		if ord(kata[i]) >= 97 and ord(kata[i]) <= 122:
			print(chr(ord(kata[i]) - 32), end='')
			kon = False
		else:
			print(kata[i], end='')
			kon = False
	elif ord(kata[i]) <= 90 and ord(kata[i]) >= 65:
		print(chr(ord(kata[i]) + 32), end='')
	else:
		print(kata[i], end='')
	if kata[i] == ' ':
		kon = True


__author__ = 'Ashu'
import re
import sys
rex = re.compile('\\w+')

def group(match):
	return match.group(0).capitalize()

def capwords(s):
	return rex.sub(group, s)
print(capwords(sys.stdin.readline()))


this = input('').split(' ')
print(' '.join([a.capitalize() for a in this]))


s = ' '.join([i.capitalize() for i in input().split(' ')])
print(s)


input_words = input().split(' ')
print(' '.join([x[0].upper() + x[1:] if x and x[0].isalpha() else x for x in input_words]))


print(' '.join([s.capitalize() for s in input().split(' ')]))


import sys
line = sys.stdin.readline()
capitalize = True
for c in line:
	if c != ' ' and capitalize:
		capitalize = False
		print(c.capitalize(), end='')
	else:
		if c == ' ':
			capitalize = True
		print(c, end='')


data = input()
print(' '.join(map(str.capitalize, data.split(' '))))


S = input()
w = S.split(' ')

def capitalizeWord(x):
	return x[0].upper() + x[1:] if x else x
w1 = map(capitalizeWord, w)
Sc = ' '.join(w1)
print(Sc)


str = input()
print(str[0].upper(), end='')
b = 1
for a in range(1, len(str)):
	if str[a] == ' ':
		print(str[a], end='')
		b = 0
	elif b == 0:
		print(str[a].upper(), end='')
		b = 1
	else:
		print(str[a], end='')


s = input()
s = s.split(' ')
x = [a.capitalize() for a in s]
print(' '.join(x))


s = input()
newWord = False
ans = ''
if s[0].isalpha() == True:
	ans += s[0].upper()
else:
	ans += s[0]
for i in range(1, len(s)):
	if s[i] != ' ':
		if newWord == True:
			if s[i].isalpha() == True:
				ans += s[i].upper()
			else:
				ans += s[i]
			newWord = False
		else:
			ans += s[i]
	elif s[i] == ' ':
		ans += s[i]
		newWord = True
print(ans)


l = input()
l = l.title()
l = list(l)
print(l[0], end='')
for i in range(1, len(l)):
	if l[i].isupper and l[i - 1] != ' ':
		l[i] = l[i].lower()
	print(l[i], end='')


import re
print(' '.join(map(lambda x: x.capitalize(), re.split('\\s', input()))))


t = True
res = ''
for c in input():
	if t:
		res += c.upper()
		t = False
	else:
		res += c
	if c == ' ':
		t = True
print(res)


def main():
	lis = input().split(' ')
	lis1 = []
	for x in lis:
		lis1.append(x.capitalize())
	lis1 = ' '.join(lis1)
	print(lis1)
main()


string = str(input())
string_list = string.split(' ')
for (index, word) in enumerate(string_list):
	if len(word) > 1:
		string_list[index] = word[0].upper() + word[1:]
	elif len(word) > 0:
		string_list[index] = word[0].upper()
print(' '.join(map(str, string_list)))


str = input().split(' ')
out = ''
for s in str:
	if len(s) == 0:
		out += ' '
	else:
		out += s[0].upper() + s[1:] + ' '
print(out)


words = input().split(' ')
processed = [x.capitalize() for x in words]
print(' '.join([str(item) for item in processed]))


mystr = input()
for i in range(len(mystr)):
	if i == 0 or mystr[i - 1] == ' ':
		print(mystr[i].upper(), end='')
	else:
		print(mystr[i], end='')


s = input()
s = s + ' '
i = 0
while i < len(s):
	if s[i] == ' ':
		print(s[i], end='')
		i += 1
	else:
		pos = s.find(' ', i, len(s))
		flag = True
		for j in range(i, pos):
			if ord(s[j]) >= 48 and ord(s[j]) <= 57:
				flag = False
				break
		if flag == True:
			print(s[i:pos].capitalize(), end='')
		else:
			print(s[i:pos], end='')
		i = pos


s = input()
if s[0] != ' ':
	s = s[0].upper() + s[1:]
for i in range(1, len(s)):
	if s[i - 1] == ' ':
		s = s[:i] + s[i].upper() + s[i + 1:]
print(s)


import re
s = re.split('(\\s+)', input())
for w in s:
	if w[0].islower():
		w = w[0].upper() + w[1:]
	print(w, end='')


text = list(input())
after_space = True
for (i, l) in enumerate(text):
	if l == ' ':
		after_space = True
	else:
		if after_space:
			text[i] = text[i].upper()
		after_space = False
print(''.join(text))


for i in input().split(' '):
	print(i.capitalize(), end=' ')


import sys
S = sys.stdin.readline()
char_prev = ' '
output = ''
for c in S:
	if char_prev == ' ':
		output += c.upper()
	else:
		output += c
	char_prev = c
print(output)


S = [c for c in input()]
cap = True
for i in range(len(S)):
	if cap == True and S[i] != ' ':
		S[i] = S[i].upper()
		cap = False
	elif S[i] == ' ':
		cap = True
print(''.join(S))


S = input()
prevchar = ' '
for eachchar in S:
	if prevchar.isspace() and (not eachchar.isspace()):
		eachchar = eachchar.upper()
	prevchar = eachchar
	print(eachchar, end='')


import re
s = input()

def repl_func(m):
	return m.group(1) + m.group(2).upper()
s = re.sub('(^|\\s)(\\S)', repl_func, s)
print(s)


line = input()
o = ''
found_space = True
for c in line:
	if c == ' ':
		found_space = True
		o += c
		continue
	elif found_space:
		o += c.capitalize()
		found_space = False
	else:
		o += c
print(o)


def cap(s):
	if not s:
		return s
	result = [s[0].upper()] if s[0].islower() else [s[0]]
	last_c = s[0]
	for i in range(1, len(s)):
		if last_c == ' ' and s[i].islower():
			result.append(s[i].upper())
		else:
			result.append(s[i])
		last_c = s[i]
	return ''.join(result)
sentence = input()
print(cap(sentence))


s = input()
list = s.split(' ')
final_list = [list[i].capitalize() for i in range(len(list))]
final_list = ' '.join(final_list)
print(final_list)


s = input()
print(' '.join([m.capitalize() for m in s.split(' ')]))


line = input()
result = ''
for index in range(0, len(line)):
	if index == 0:
		if not line[index].isspace():
			result += line[index].upper()
		else:
			result += line[index]
	elif line[index - 1].isspace():
		result += line[index].upper()
	else:
		result += line[index]
print(result)


import re
s = re.split(' ', input())
l = len(s)
output = ''
for i in range(l - 1):
	if s[i] == '':
		output += ' '
	else:
		output += s[i].capitalize() + ' '
output += s[l - 1].capitalize()
print(output)


print(' '.join(map(lambda x: x.capitalize(), input().split(' '))))


s = input().strip().split(' ')
sd = []
for z in s:
	if len(z) == 0:
		sd.append(z)
		continue
	if ord(z[0]) <= 122 and ord(z[0]) >= 97:
		try:
			sd.append(z[0].upper() + z[1:])
		except:
			sd.append(z.upper())
	else:
		sd.append(z)
sdc = ''
for z in sd:
	sdc += z + ' '
sdc.strip()
print(sdc)


import string
s = input()
print(string.capwords(s, ' '))


a = input().split(' ')
s = ''
for i in a:
	s += i.capitalize() + ' '
print(s.strip())


s = input()
capS = ''
prevSpace = True
for ch in s:
	if prevSpace:
		capS += ch.upper()
		prevSpace = False
	else:
		capS += ch
	if ch == ' ':
		prevSpace = True
print(capS)


import sys
data = sys.stdin.readlines()

def foo(s):
	last_space = True
	result = ''
	for i in range(len(s)):
		if s[i].isspace():
			last_space = True
			result += s[i]
		elif last_space:
			result += s[i].upper()
			last_space = False
		else:
			result += s[i]
	return result
print(foo(data[0]))


import sys
stdin = sys.stdin
for line in stdin:
	for i in range(len(line)):
		if i == 0 or (line[i] != ' ' and line[i - 1] == ' '):
			sys.stdout.write(line[i].capitalize())
		else:
			sys.stdout.write(line[i])


text = input()
words = text.split(' ')
caps = map(str.capitalize, words)
print(' '.join(caps))


f = 1
for c in input():
	print(end=f * c.title() or c)
	f = c == ' '


import re
s = re.split('(\\s+)', input())
for (n, i) in enumerate(s):
	if s[n][0] in '0123456789':
		pass
	else:
		s[n] = s[n].title()
print(''.join(s))


s = input()
out = ''
blank = True
for c in s:
	if c.isspace():
		blank = True
	elif blank and c.isalpha():
		c = c.upper()
		blank = False
	elif c.isnumeric():
		blank = False
	out += c
print(out)


s = input()
s = list(s)
if ord(s[0]) >= 97 and ord(s[0]) <= 122:
	s[0] = chr(ord(s[0]) - 32)
for i in range(1, len(s)):
	if s[i - 1] == ' ' and ord(s[i]) >= 97 and (ord(s[i]) <= 122):
		s[i] = chr(ord(s[i]) - 32)
s = ''.join(s)
print(s)


import re

def capitalize(word):
	return word[0].upper() + word[1:]
text = input()
words = re.findall('\\w+', text)
spaces = re.findall('\\s+', text)
capitalized_words = [capitalize(w) for w in words]
result = capitalized_words.pop(0)
for (word, space) in zip(capitalized_words, spaces):
	result += space + word
print(result)


q = input()
a = q.split(' ')
x = ''
for i in range(len(a)):
	s = a[i]
	if len(s) != 0:
		x += s[0].capitalize() + s[1:] + ' '
	else:
		x += ' '
x = x[:len(x) - 1]
print(x)


import string
import sys
for line in sys.stdin:
	print(string.capwords(line, sep=' '))


S = input()
s = S.split(' ')
x = map(str.capitalize, s)
O = ' '.join(x)
print(O)


import sys
s = sys.stdin.readline()
ret = [None] * len(s)
ret[0] = s[0].upper()
for i in range(1, len(s)):
	if s[i - 1] == ' ':
		ret[i] = s[i].upper()
	else:
		ret[i] = s[i]
print(''.join(ret))


import sys
strings = sys.stdin.readline()
ret = []
for string in strings.split(' '):
	ret.append(string.capitalize())
print(' '.join(ret))


s = input()
if s[0].isalpha():
	print(s[0].upper(), end='')
else:
	print(s[0], end='')
prev = s[0]
for c in s[1:]:
	if prev == ' ':
		print(c.upper(), end='')
	else:
		print(c, end='')
	prev = c


def capWords(s):
	if s.isalpha():
		return s.capitalize()
	else:
		return s
print(*list(map(capWords, input().split(' '))))


import string
s = input()
l = s.split()
for i in range(len(l)):
	if l[i][0] in string.ascii_lowercase:
		l[i] = l[i].title()
o = ''
i = 0
j = 0
while i < len(s):
	while s[i] == ' ' and i < len(s):
		o += ' '
		i += 1
	if s[i] != ' ' and i < len(s) and (j < len(l)):
		o += l[j]
		i += len(l[j])
		j += 1
print(o)


val = input()
vs = val.title()
ws = ' '.join([x.capitalize() for x in val.split()])
if len(val) == len(ws):
	print(ws)
else:
	print(vs)


def isSmall(x):
	return 'a' <= x <= 'z'
S = list(input())
if isSmall(S[0]):
	S[0] = chr(ord(S[0]) - 32)
i = 1
while i < len(S):
	if isSmall(S[i]) and S[i - 1] == ' ':
		S[i] = chr(ord(S[i]) - 32)
	i += 1
print(''.join(S))


import re
print(''.join([word.capitalize() for word in re.split('(\\W+)', input())]))


import re
s = input()
s = re.split('(\\s+)', s)
ans = ''
for i in range(len(s)):
	if s[i][0].isdigit():
		ans += s[i]
	else:
		ans += s[i].capitalize()
print(ans.rstrip())


S = input()
import re

def repl(m):
	word = m.group(1)
	return word.capitalize()
print(re.sub('(\\w+)', repl, S))


a = [i for i in input()]
for (i, x) in enumerate(a):
	if i == 0 or a[i - 1] == ' ':
		a[i] = a[i].upper()
print(''.join(a))


def main():
	s = input()
	l = ['' if i == '' else ''.join(i[0].upper() + i[1:]) for i in s.split(' ')]
	print(' '.join(l))
main()


__author__ = 'namii'
inputword = input()
for (i, letter) in enumerate(inputword):
	if i == 0 or inputword[i - 1] == ' ':
		print(inputword[i].capitalize(), end='')
	else:
		print(inputword[i], end='')


tempStr = input()
newStr = ''
for i in range(len(tempStr)):
	if i == 0 or tempStr[i - 1] == ' ':
		newStr += tempStr[i].upper()
	else:
		newStr += tempStr[i]
print(newStr)


strr = input()
import re

def titlecase(s):
	return re.sub("[A-Za-z0-9]+('[A-Za-z0-9]+)?", lambda mo: mo.group(0)[0].upper() + mo.group(0)[1:].lower(), s)
print(titlecase(strr))


import string
print(string.capwords(input().strip(), ' '))


import string
a = input()
b = ''
docap = True
for i in range(len(a)):
	if docap and a[i] in string.ascii_letters + string.digits:
		b += a[i].upper()
		docap = False
	else:
		b += a[i]
	if a[i] == ' ':
		docap = True
print(b)


import re

def captialize():
	all_words = input()
	if len(all_words) < 1 or len(all_words) >= 1000:
		return None
	words = re.split('(\\s+)', all_words)
	for word in words:
		print(word[:1].upper() + word[1:].lower(), end='')
captialize()


l = input()
flag = 1
r = l[0].upper()
for i in range(1, len(l)):
	if l[i - 1] == ' ':
		r += l[i].upper()
	else:
		r += l[i]
print(r)


import string
import sys

def capitalize(data):
	res = []
	prev = None
	for c in data:
		if prev is None or (c in string.ascii_letters and prev in string.whitespace):
			res.append(c.upper())
		else:
			res.append(c)
		prev = c
	return ''.join(res)

def run():
	print(capitalize(sys.stdin.read()))
run()


n = input()
list1 = n.split(' ')
for i in list1:
	print(i.capitalize(), end=' ')


s = list(input())
a = []
a.append(s[0].upper())
for i in range(len(s) - 1):
	if s[i] == ' ':
		a.append(s[i + 1].upper())
	else:
		a.append(s[i + 1])
print(''.join(a))


import sys
for line in sys.stdin:
	if len(line) > 0 and len(line) < 1000:
		new = [l for l in line]
		for w in line.strip().split():
			begin = w[0]
			if begin.isalpha():
				begin = begin.upper()
			new_word = begin + w[1:]
			indice = line.index(w)
			cont = 0
			for i in range(indice, indice + len(w)):
				new[i] = new_word[cont]
				cont += 1
		print(''.join(new))


import re
in_str = input()

def change(w):
	return w.group(1) + w.group(2).upper()
print(re.sub('(^|\\s)(\\S)', change, in_str))


import sys
arr = input().split(' ')
for str in arr:
	print(str[:1].title() + str[1:] + ' ', end='')


c = 0
L = list(input())
for k in range(len(L)):
	if k == 0:
		print(L[k].upper(), end='')
		continue
	if L[k] == ' ':
		c = 1
		print(' ', end='')
		continue
	if c == 1:
		print(L[k].upper(), end='')
		c = 0
	else:
		print(L[k], end='')


input_string = input()
tokens = input_string.split(' ')
output_string = ''
for i in range(len(tokens)):
	tokens[i] = tokens[i].capitalize()
print(' '.join(tokens))


s = input()
s = s.split(' ')
for w in s:
	w = w.capitalize()
	print(w, end=' ')


import sys

def cap(s):
	if len(s) == 0:
		return ''
	return s[0].upper() + s[1:]

def solve(s):
	return ' '.join(map(cap, s.split(' ')))
print(solve(sys.stdin.readline().strip()))


def cap(s):
	if len(s) == 0:
		return ''
	if len(s) == 1:
		return s.upper()
	return s[0].upper() + s[1:]
s = [cap(i) for i in input().split(' ')]
print(' '.join(s))


import re
txt = input()
print(re.sub('[^\\s]+', lambda x: x.group(0).capitalize(), txt))


s = input()
ss = s[0].upper()
ok = s[0] == ' '
for c in s[1:]:
	if c == ' ':
		ok = True
		ss += c
	elif ok:
		ss += c.upper()
		ok = False
	else:
		ss += c
		ok = False
print(ss)


x = input()
l = []
l = x.split(' ')
for i in range(0, len(l)):
	l[i] = l[i].capitalize()
x = ' '.join(l)
print(x)


s = input()
print(s[0].upper(), end='')
for x in range(1, len(s)):
	if s[x - 1] == ' ':
		print(s[x].upper(), end='')
	else:
		print(s[x], end='')


n = input().split(' ')
for i in n:
	print(i.capitalize(), end=' ')


print(' '.join([i.capitalize() for i in input().split(' ')]))


s = input()
s_ar = s.split(' ')
final_ar = []
space = ' '
for w in s_ar:
	final_ar.append(w.capitalize())
print(space.join(final_ar))


givenString = input()
for word in givenString.split(' '):
	print(word.capitalize(), end=' ')


import re

def main():
	c = ''
	ain = input()
	b = re.split('(\\s+)', ain)
	for s in b:
		if ord(s[0]) >= 97 and ord(s[0]) <= 126:
			c += s.title()
		else:
			c += s
	print(c)
main()


import string
print(string.capwords(input(), ' '))


s = input()
s = s[0].upper() + s[1:]
for i in range(1, len(s) - 1):
	if s[i] == ' ':
		s = s[:i + 1] + s[i + 1].upper() + s[i + 2:]
print(s)


import sys
import re
line = re.split('(\\s+)', sys.stdin.readline().rstrip())
print(''.join(list(map(lambda x: x.capitalize(), line))))


def Cap(x):
	return x.capitalize()
L = list(map(Cap, input().split(' ')))
str = ' '.join(L)
print(str)


s = []
s = input().split(' ')
for str in s:
	print(str.capitalize(), end=' ')


__author__ = 'gauth_000'
string = list(input())
space = True
for i in range(len(string)):
	if string[i] == ' ':
		space = True
	elif space:
		space = False
		string[i] = string[i].upper()
print(''.join(string))