Get first letter

Inputs

  • String

Outputs

  • First letter
  • Residue

Neuron type

Best algorithm has been found - locked

Patterns

Pattern Input Output
1.
String: hello
First letter: h
Residue: ello
2.
String: 12345
First letter: 1
Residue: 2345
3.
String: Get first letter
First letter: G
Residue: et first letter

Applicable neurons

  • 0
  • 1
  • Substring (from start to position)
  • Substring (from position to end)
  • x - 1
  • tag title
  • a ≤ b
  • logical riddle 7+3
  • select sum (A, B, C)
  • Is it integer?

Algorithm

Test

Code made by AI:
/**
 * 1: 
 *
 * @return {Array}
 */
function neuron501()
{
return [1];
}

/**
 * Length of string: 
 *
 * @param x1 String
 * @return {Array}
 */
function neuron528(x1)
{
return[x1.toString().length];
}

/**
 * Substring (startPosition, endPosition): Get substring from string - from position - to pos
 *
 * @param x1 MyString
 * @param x2 start position
 * @param x3 end position
 * @return {Array}
 */
function neuron525(x1, x2, x3)
{
return[x1.toString().substring(x2, x3)];
}

/**
 * Substring (from position to end): 
 * 
 * @param x1 MyString
 * @param x2 start position
 * @return {Array}
 */
function neuron529(x1, x2)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;

  arr = neuron528(outputs[0]);
  outputs[2] = arr[0];

  arr = neuron525(outputs[0], outputs[1], outputs[2]);
  outputs[3] = arr[0];

  return[outputs[3]];
}


/**
 * 0: 
 *
 * @return {Array}
 */
function neuron500()
{
return [0];
}

/**
 * Substring (startPosition, endPosition): Get substring from string - from position - to pos
 *
 * @param x1 MyString
 * @param x2 start position
 * @param x3 end position
 * @return {Array}
 */
function neuron525(x1, x2, x3)
{
return[x1.toString().substring(x2, x3)];
}

/**
 * Substring (from start to position): 
 * 
 * @param x1 String
 * @param x2 End position
 * @return {Array}
 */
function neuron526(x1, x2)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;

  arr = neuron500();
  outputs[2] = arr[0];

  arr = neuron525(outputs[0], outputs[1], outputs[2]);
  outputs[3] = arr[0];

  return[outputs[3]];
}


/**
 * Get first letter: 
 * 
 * @param x1 String
 * @return {Array}
 */
function neuron671(x1)
{
  var outputs = [];
  outputs[0] = x1;

  arr = neuron501();
  outputs[1] = arr[0];

  arr = neuron529(outputs[0], outputs[1]);
  outputs[2] = arr[0];

  arr = neuron526(outputs[0], outputs[1]);
  outputs[3] = arr[0];

  return[outputs[3], outputs[2]];
}


Code made by AI:

Rodokmen - poznejte své předky | TOPlist U.I., Umělá inteligence