• 1182 字符串长度

    Time Limit : 2000/1000 MS(Java/Others) | Memory Limit : 65536/32768 KB(Java/Others)

    Submits : 17320 | Solved : 10498

    Description

    输入一个字符串,设计函数计算其有效长度,最终输出字符串长度及该字符串内容。不要使用系统提供的strlen函数。

    Input

    输入一个字符串,以换行符结束。字符串长度不超过100。

    Output

    输出有效长度及字符串内容。

    Sample Input

    world

    Sample Output

    5 world

    Template

    #include<stdio.h>
    @-@  //设计求字符串长度的函数
    int main()
    {
    char str[101];
    int len=0;
    gets(str);
    len=mylen(str);  //调用函数求字符串长度
    printf("%d ",len);
    printf("%s\n",str);
    return 0;
    }
    

    HINT


    Source

    NBU OJ

    [ Top ] | [ Submit ] | [ Statistics ] | [ Standing ]