We’ve all seen katas that ask for conversion from snake-case to camel-case, from camel-case to snake-case, or from camel-case to kebab-case — the possibilities are endless.

But if we don’t know the case our inputs are in, these are not very helpful.

### Task:

So the task here is to implement a function (called `id` in Ruby/Crystal/JavaScript/CoffeeScript and `case_id` in Python/C) that takes a string, `c_str`, and returns a string with the case the input is in. The possible case types are “kebab”, “camel”, and ”snake”. If none of the cases match with the input, or if there are no 'spaces' in the input (for example in snake case, spaces would be '_'s), return “none”. Inputs will only have letters (no numbers or special characters).

### Some definitions

Kebab case: `lowercase-words-separated-by-hyphens`

Camel case: `lowercaseFirstWordFollowedByCapitalizedWords`

Snake case: `lowercase_words_separated_by_underscores`

### Examples:

```python
case_id(“hello-world”) #=> “kebab”
case_id(“hello-to-the-world”) #=> “kebab”
case_id(“helloWorld”) #=> “camel”
case_id(“helloToTheWorld”) #=> “camel”
case_id(“hello_world”) #=> “snake”
case_id(“hello_to_the_world”) #=> “snake”
case_id(“hello__world”) #=> “none”
case_id(“hello_World”) #=> “none”
case_id(“helloworld”) #=> “none”
case_id(“hello-World”) #=> “none”
```

Also check out my other creations — [Split Without Loss](https://www.codewars.com/kata/split-without-loss), [Adding Fractions](https://www.codewars.com/kata/adding-fractions),
[Random Integers](https://www.codewars.com/kata/random-integers), [Implement String#transpose](https://www.codewars.com/kata/implement-string-number-transpose), [Implement Array#transpose!](https://www.codewars.com/kata/implement-array-number-transpose), [Arrays and Procs #1](https://www.codewars.com/kata/arrays-and-procs-number-1), and [Arrays and Procs #2](https://www.codewars.com/kata/arrays-and-procs-number-2)

Difficulty: EASY
Starter code: def case_id(c_str):
	

Solutions:
import re
CASES = [('snake', re.compile('\\A[a-z]+(_[a-z]+)+\\Z')), ('kebab', re.compile('\\A[a-z]+(-[a-z]+)+\\Z')), ('camel', re.compile('\\A[a-z]+([A-Z][a-z]*)+\\Z')), ('none', re.compile(''))]

def case_id(c_str):
	for (case, pattern) in CASES:
		if pattern.match(c_str):
			return case


import re

def case_id(c_str):
	if re.match('^([a-z]+\\-)+[a-z]+$', c_str):
		return 'kebab'
	if re.match('^([a-z]+\\_)+[a-z]+$', c_str):
		return 'snake'
	if re.match('^([a-z]+[A-Z])+[a-z]+$', c_str):
		return 'camel'
	return 'none'


def case_id(stg):
	print(stg)
	if '-' in stg and '_' not in stg and all((w.islower() for w in stg.split('-'))):
		return 'kebab'
	if '_' in stg and '-' not in stg and all((w.islower() for w in stg.split('_'))):
		return 'snake'
	if stg.isalpha() and any((c.isupper() for c in stg)):
		return 'camel'
	return 'none'


from string import ascii_lowercase as ASCII_LOW, ascii_letters as ASCII_LET

def is_kebab_case(str_):
	for char in str_:
		if char not in ASCII_LOW + '-':
			return False
	if '' in str_.split('-'):
		return False
	return True

def is_camel_case(str_):
	for char in str_:
		if char not in ASCII_LET:
			return False
	if str_[0].isupper():
		return False
	return True

def is_snake_case(str_):
	for char in str_:
		if char not in ASCII_LOW + '_':
			return False
	if '' in str_.split('_'):
		return False
	return True

def case_id(c_str):
	for func in (is_kebab_case, is_camel_case, is_snake_case):
		if func(c_str):
			return {'is_kebab_case': 'kebab', 'is_camel_case': 'camel', 'is_snake_case': 'snake'}[func.__name__]
	return 'none'


def case_id(s):
	if '--' in s or ('_' in s and '-' in s):
		return 'none'
	if s.replace('_', '').replace('-', '').islower():
		if '-' in s:
			return 'kebab'
		if '_' in s:
			return 'snake'
	if '-' in s or '_' in s:
		return 'none'
	return 'camel'


def case_id(c_str):
	if '--' in c_str or ('_' in c_str and '-' in c_str):
		return 'none'
	elif c_str.replace('_', '').replace('-', '').islower():
		if '-' in c_str:
			return 'kebab'
		elif '_' in c_str:
			return 'snake'
	elif '-' in c_str or '_' in c_str:
		return 'none'
	return 'camel'


def is_kebab(s):
	arr = s.split('-')
	res = [part.islower() and '_' not in part and (part != '') for part in arr]
	return all(res)

def is_snake(s):
	arr = s.split('_')
	res = [part.islower() and '-' not in part and (part != '') for part in arr]
	return all(res)

def is_camel(s):
	return '-' not in s and '_' not in s and (not s.islower())

def case_id(c_str):
	if is_kebab(c_str):
		return 'kebab'
	if is_snake(c_str):
		return 'snake'
	if is_camel(c_str):
		return 'camel'
	return 'none'