String Length
Completed
Read a word and print its length twice: with strlen and with your own loop that counts until '\0'.
Input
One word.
Output
Two lines.
Example
Input
hello
Output
5 5
Editor
C
Hints
A C string ends with the null character '\0'.
scanf with %s takes the array name without &.
Solution explanation
C strings are just char arrays with a terminating '\0'; strlen counts up to it.
Show solution
#include <stdio.h>
#include <string.h>
int main() {
char s[100];
scanf("%s", s);
int n = 0;
while (s[n] != '\0') n++;
printf("%d\n%d\n", (int) strlen(s), n);
return 0;
}