View Code of Problem 108

#include <stdio.h>
#include <string.h>
int main(){
	int n;
	scanf("%d",&n);
	while(n){
		char str[50];
		scanf("%s",str);
		int len = strlen(str);
		if(len==1) printf("1\n");
		else if(len==2) printf("2\n");
		else printf("%d\n",(len-2)*2+2);
		n--;
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 108