-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIPMANORI.cpp
More file actions
45 lines (43 loc) · 862 Bytes
/
IPMANORI.cpp
File metadata and controls
45 lines (43 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include<stdio.h>
#include<string.h>
int main()
{
int t;
scanf("%d", &t);
getchar();
char string[105];
for(int k = 0; k < t; k++){
scanf("%s", string); getchar();
int len = strlen(string);
int valid = 0;
int counterangka = 0;
int countertitik = 0;
for(int i = 0; i < len; i++){
if(string[0] == '.' || string[len-1] == '.'){
valid = 1;
break;
} else if(string[i] == '.' && string[i+1] == '.'){
valid = 1;
break;
} else{
if(string[i] == '.'){
valid = 0;
countertitik++;
} else if(string[i] >= '0' && string[i] <= '9'){
valid = 0;
}
}
}
printf("Case #%d: ", k+1);
if(valid == 1){
printf("NO\n");
} else if(valid == 0){
if(countertitik == 5){
printf("YES\n");
} else{
printf("NO\n");
}
}
}
return 0;
}