public class Test {
public static void main(String[] args) {
String s = "a,b,c,d,e,f,g,h,i,j,k";
for(int i=1;i<=s.length();i++){
System.out.print(s.charAt(i-1));
if(i%6==0){
System.out.print(i/6+" ");
}
}
if(s.length()%6!=0){
System.out.print(","+(s.length()/6+1)+" ");
}
}
}
JAVA上的问题,楼上搞PHP,我服了你了,老大
@$arr=array(a,b,c,d,e,f,g,h,i,j,k);
$m=count($arr);
foreach ($arr as $k => $v) {
echo $v;
$d = $k +1;
if ($d % 3 == 0 && $d != 0) {
echo $d / 3;
}
}
if($m%3!=0){
echo ceil($m/3);
}
?>