human
Convert a sentence into its equivalent mobile numeric keypad sequence | Function which computes the sequence.
length of input string.
checking for space.
calculating index for each character.
output sequence.
storing the sequence in array"
Solution in Python:
 Can you provide a code to convert a sentence into its equivalent mobile numeric keypad sequence and the other steps required?
assistant
#Here is code to convert a sentence into its equivalent mobile numeric keypad sequence and the other steps required.
 def printSequence ( arr , input ) :
	n = len ( input )
	output = " "
	for i in range ( n ) :
		if ( input [ i ] == ' ▁ ' ) :
			output = output + "0"
		else :
			position = ord ( input [ i ] ) - ord ( ' A ' )
			output = output + arr [ position ]
	return output
str = [ "2" , "22" , "222" , "3" , "33" , "333" , "4" , "44" , "444" , "5" , "55" , "555" , "6" , "66" , "666" , "7" , "77" , "777" , "7777" , "8" , "88" , "888" , "9" , "99" , "999" , "9999" ]
input = " GEEKSFORGEEKS " ;
print ( printSequence ( str , input ) )