<?php
// just comment/uncomment to choose which $data you want to see in action
$data = array("kaushik","kaushik is","kaushik is great","is","is great","great");
//$data = array("usb","pc","cam 168","cam","168");
$current = "";
for($i=0;$i<count($data);$i++)
{
$current=$data[$i];
for($j=0;$j<count($data);$j++)
{
if($i<>$j)
{
if((str_replace($data[$j],"",$current))!=$current)
{
$data[$j]="";
};
}
}
}
for($i=0;$i<count($data);$i++)
{
if($data[$i]!="")
{
echo $data[$i]."\n";
}
}
?>
preferences:
38.09 ms | 402 KiB | 5 Q