Submission #6956046


Source Code Expand

Copy
<?php
fscanf(STDIN, '%s', $s);
$n = strlen($s);
$arr = [$s[0]];
$s_tmp = '';
for($i = 1; $i < $n; $i++) {
    $m = count($arr);
    $s_tmp = $s_tmp . $s[$i];
    if ($arr[$m-1] !== $s_tmp) {
        $arr[] = $s_tmp;
        $s_tmp = '';
    }
}
$ans = count($arr);
echo $ans . PHP_EOL;

Submission Info

Submission Time
Task A - Dividing a String
User hideyuk1
Language PHP7 (7.0.15)
Score 300
Code Size 299 Byte
Status
Exec Time 41 ms
Memory 19060 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample01.txt, sample02.txt
All 300 / 300 sample01.txt, sample02.txt, in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, sample01.txt, sample02.txt
Case Name Status Exec Time Memory
in01.txt 41 ms 19060 KB
in02.txt 40 ms 18932 KB
in03.txt 39 ms 18932 KB
in04.txt 39 ms 18932 KB
in05.txt 41 ms 18932 KB
in06.txt 39 ms 18932 KB
in07.txt 34 ms 18932 KB
in08.txt 37 ms 18932 KB
in09.txt 37 ms 18932 KB
in10.txt 37 ms 18932 KB
in11.txt 8 ms 4604 KB
in12.txt 8 ms 4604 KB
in13.txt 8 ms 4604 KB
in14.txt 8 ms 4604 KB
in15.txt 9 ms 4604 KB
in16.txt 8 ms 4604 KB
in17.txt 41 ms 18932 KB
in18.txt 9 ms 4604 KB
in19.txt 8 ms 4604 KB
sample01.txt 8 ms 4604 KB
sample02.txt 8 ms 4604 KB