-
Notifications
You must be signed in to change notification settings - Fork 0
/
phonenumber.php
40 lines (36 loc) · 958 Bytes
/
phonenumber.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
fscanf(STDIN, "%d", $N);
$list = [];
for ($i = 0; $i < $N; $i++)
{
fscanf(STDIN, "%s", $t);
$temp = stockerSousChaines($t);
foreach ($temp as $v)
{
//if($i==1)
//{ error_log(var_export($v, true));error_log(var_export($list, true));die(); }
if (!in_array($v,$list,true))
{
$list[]=$v;
}
}//end foreach
}
function stockerSousChaines($chaine) {
$longueur = strlen($chaine);
$tableau = [];
$sousChaine = '';
for ($i = 0; $i < $longueur; $i++) {
$sousChaine .= $chaine[$i];
$tableau[] = $sousChaine;
}
return $tableau;
}
// Write an answer using echo(). DON'T FORGET THE TRAILING \n
// To debug: error_log(var_export($var, true)); (equivalent to var_dump)
//error_log(var_export($list, true));die;
echo count($list);
?>