NOt able to check empty string :     #include<cstdio>
    #include<cstring>
    using namespace std;
    
    int main()
    {
    	int t,l;
    	char a[22];
    	a[0]='0';
    	for(t=1;t<=20;t++)
    	{
    		l=1;
		    scanf("%s",a+1);
		
		    if(strlen(a)>1)
			    l=strlen(a);
		    printf("%d\n",l-1);
    	}
    	 return 0;
    }

When I am inputting any string with length >=1 then I get the correct answer for the length of string but when just use the keystroke enter or space then it does not print 0. Since the string is empty(containing only zero) it should print 0(l-1=0) because if condition gets false.