Given a positive integer num consisting only of digits 6 and 9.

Return the maximum number you can get by changing at most one digit

(6 becomes 9, and 9 becomes 6).

**Input_1:
**Enter a number = 9669
**Output:** 9969
**Explanation:
**Changing the first digit results in 6669.
Changing the second digit results in 9969.
Changing the third digit results in 9699.
Changing the fourth digit results in 9666.
The maximum number is 9969.
**Input_2:**
Enter a number = 9996
**Output:** 9999
**Explanation:** Changing the last digit 6 to 9 results in the maximum number.
Example 3:
**Input_3:** num = 9999
**Output:** 9999
**Explanation:** No Need To Change

num=int(input('Enter a Number : ')) str1=list(str(num)) MAXI=0 for i in range(0,len(str1)): temp=str1.copy() temp[i] = '9' if temp[i]=='6' else '6' num1=int(''.join(temp)) MAXI = num1 if num1>MAXI else MAXI print(MAXI) if MAXI>num else print("No Need To Change")

**Input_1:**

Enter a Number : 9669**Output:**

9969

**Input_2:**

Enter a Number : 9999**Output:**

No Need To Change

**Input_3:**

Enter a Number : 6669**Output:**

9669

**Input_4:**

Enter a Number : 9996 **Output:**

9999

**Input_5:**

Enter a Number : 6996**Output:**

9996

**Input_6:**

Enter a Number : 6999**Output:**

9999

**Input_7:**

Enter a Number : 6699**Output:**

9699

**More Q**

- Find the majority element appearing more than n/2 times
- Return an array of the squares of each number.
- Highest factor in addition.
- Find the empty packets(0) of chocolate and push it to the end of the conveyor belt(array).
- Every element in array appears twice.Find that single one.
- Find the duplicate letters in string. Same to do in dictionary way.
- Find minimum number of edits (operations) required to convert ‘str1’ into ‘str2’.
- Return the maximum number you can get by changing at most one digit.
- Sed Commands – Ranges of lines.
- Find the kth smallest element in the given 2D array.
- Find all elements that appear more than [n/3] times.
- Write a function to return true if s2 contains the permutation of s1.
- Sort the array into a wave like array.
- Re-order array, such that
`nums[0] < nums[1] > nums[2] < nums[3]...`

. - Given the coordinates, return true if the four points construct a square.
- Minimum Distance Between Words of a String.
- Return the shortest distance between these two words.
- Write a program to find the n-th ugly number.
- Check if array could become Non – Decreasing array.
- Find the minimum area of a rectangle that can be formed from given points.