# Task
 Smartphones software security has become a growing concern related to mobile telephony. It is particularly important as it relates to the security of available personal information.
 
 For this reason, Ahmed decided to encrypt phone numbers of contacts in such a way that nobody can decrypt them. At first he tried encryption algorithms very complex, but the decryption process is tedious, especially when he needed to dial a speed dial.

 He eventually found the algorithm following: instead of writing the number itself, Ahmed multiplied by 10, then adds the result to the original number.
 
 For example, if the phone number is `123`, after the transformation, it becomes `1353`. Ahmed truncates the result (from the left), so it has as many digits as the original phone number. In this example Ahmed wrote `353` instead of `123` in his smart phone.

 Ahmed needs a program to recover the original phone number from number stored on his phone. The program return "impossible" if the initial number can not be calculated.
 
 Note: There is no left leading zero in either the input or the output; Input `s` is given by string format, because it may be very huge ;-)

# Example

 For `s="353"`, the result should be `"123"`
 
 ```
    1230
  +  123
  .......
  = 1353  
  
  truncates the result to 3 digit -->"353"
  
  So the initial number is "123"
 ```
 For `s="123456"`, the result should be `"738496"`
 
 ```
    7384960
  +  738496
  .........
  = 8123456
  
  truncates the result to 6 digit -->"123456"
  
  So the initial number is "738496"
 ```
 For `s="4334"`, the result should be `"impossible"`
 
 Because no such a number can be encrypted to `"4334"`.

# Input/Output


 - `[input]` string `s`

  string presentation of n with `1 <= n <= 10^100`


 - `[output]` a string

  The original phone number before encryption, or `"impossible"` if the initial number can not be calculated.

Source: codewars | Difficulty: EASY
Tags: Ad-hoc

Starter code: def decrypt(s):
	

Solutions:
def decrypt(s):
	return next((str(b // 11) for b in (int(str(a) + s) for a in range(1, 11)) if b % 11 == 0), 'impossible')


def decrypt(s):
	for i in range(1, 11):
		n = int(str(i) + s)
		if n // 11 * 11 == n:
			return str(n // 11)
	return 'impossible'


def decrypt(s):
	(x, l) = (int(s), 10 ** len(s))
	for i in range(l + x, 11 * l + x, l):
		if not i % 11:
			return str(i // 11)
	return 'impossible'


def decrypt(s):
	for i in range(1, 100):
		n = int(str(i) + s)
		if n % 11 == 0 and len(str(n // 11)) == len(s):
			return str(n // 11)
	return 'impossible'


def decrypt(s):
	for n in range(1, 11):
		(res, mod) = divmod(int(str(n) + s), 11)
		if mod == 0:
			return str(res)
	return 'impossible'


def decrypt(s):
	(prev, c) = (int(s[-1]), 0)
	res = [prev]
	for d in s[::-1][1:]:
		x = int(d) - prev - c
		(prev, c) = ((x + 10) % 10, x < 0)
		res.append(prev)
	return 'impossible' if res[-1] == 0 else ''.join(map(str, res[::-1]))


def decrypt(s):
	for i in range(1, 11):
		a = int(str(i) + s)
		if a % 11 == 0:
			return str(a // 11)
	return 'impossible'


def decrypt(s):
	for a in range(1, 11):
		if (a * 10 ** len(s) + int(s)) % 11 == 0:
			return str((a * 10 ** len(s) + int(s)) // 11)
	return 'impossible'


def decrypt(s):
	(prev, c, r) = (0, 0, [])
	for x in reversed(s):
		d = int(x) - c - prev
		if d < 0:
			d += 10
			c = 1
		else:
			c = 0
		r.append(str(d))
		prev = d
	return 'impossible' if not prev else ''.join(r[::-1])