Created
January 31, 2014 20:03
-
-
Save p4ulypops/8741858 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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