human
Convert given string to a valid mobile number | Function to print valid and formatted phone number.
Length of given.
Store digits in temp.
Iterate given M.
If any digit : append it to temp.
Find new length of.
If length is not equal to 10.
Store final result.
Make groups of 3 digits and enclose them within ( ) and separate them with " - " 0 to 2 index 1 st group.
3 to 5 index 2 nd group.
6 to 8 index 3 rd group.
9 to 9 index last group.
Print final result.
Driver Code.
Given.
Function Call"
Solution in Python:

=====
What is a code to convert given string to a valid mobile number and the other steps required?
assistant
#Here is code to convert given string to a valid mobile number and the other steps required.
 def Validate ( M ) :
	lenn = len ( M )
	temp = " "
	for i in range ( lenn ) :
		if ( M [ i ] . isdigit ( ) ) :
			temp += M [ i ]
	nwlenn = len ( temp )
	if ( nwlenn != 10 ) :
		print ( " Invalid " )
		return
	res = " "
	x = temp [ 0 : 3 ]
	res += " ( " + x + " ) - "
	x = temp [ 3 : 3 + 3 ]
	res += " ( " + x + " ) - "
	x = temp [ 6 : 3 + 6 ]
	res += " ( " + x + " ) - "
	x = temp [ 9 : 1 + 9 ]
	res += " ( " + x + " ) "
	print ( res )
if __name__ == ' _ _ main _ _ ' :
	M = "91 ▁ 234rt5%34*0 ▁ 3"
	Validate ( M )