Skip to content

Instantly share code, notes, and snippets.

@p4ulypops
Created January 31, 2014 20:03
Show Gist options
  • Save p4ulypops/8741858 to your computer and use it in GitHub Desktop.
Save p4ulypops/8741858 to your computer and use it in GitHub Desktop.
<?php
////////////////////////////////////
// This is my answer to the following
// http://skilleo.me/challenge/2
//
//
// Seems to crash it out =/
////////////////////////////////////
function pairOfCharacters($a) {
/* Create the code to find the pair of characters here. */
/* Create the code to find the pair of characters here. */
$tmp = array();
foreach($a as $char) {
$tmp[$char] = (isset($tmp[$char]) ? $tmp[$char]++ : 1);
}
foreach($tmp as $key => $val) {
if($val > 1) { echo $key."\n"; }
}
}
$__fp = fopen("php://stdin", "r");
$_a = fgets($__fp);
$_a = explode(' ',$_a);
$res = pairOfCharacters($_a);
echo $res;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment