protected function matchChoice(ChoiceQuestion $question, $input) {
		$choices = $question->getChoices();

		if (isset($choices[$input])) {
			return $input;
		}

		$matchedValues = [];
		foreach ($choices as $key => $value) {
			if (stripos($value, $input) === 0) {
				$input = $key;
				$matchedValues[] = $value;
			}
		}

		if (count($matchedValues) > 1) {
			throw new InvalidArgumentException(sprintf(
				'The provided answer is ambiguous. Value should be one of %s.',
				implode(' or ', $matchedValues)
			));
		}

		return $input;
	}