1.2
YES
#include <bits/stdc++.h> using namespace std; char s[300]; bool flag = 1; int cnt1 = 0, cnt2 = 0, cnt3 = 0; int numb(char a){ if(a >= '0' && a <= '9') return 1; return 0; } int main() { scanf("%[^\n]", s); int n = strlen(s); int l = 0, r = n - 1; while(s[l] == ' ') l++; while(s[r] == ' ') r--; int i = l; while(i <= r){ if(s[i] == '.'){ cnt1++; if(i == l || i == r || cnt2 == 1 || cnt3 == 1 ){ flag = 0; break; } if(numb(s[i-1]) == 0 || numb(s[i+1]) == 0){ flag = 0; break; } } else if(s[i] == '-' || s[i] == '+'){ cnt2++; if(i == l){ cnt2--; i++; continue; } if(i == r){ flag = 0; break; } else if((s[i-1] != 'e' && s[i-1] != 'E') || numb(s[i+1] == 0) ){ flag = 0; break; } } else if(s[i] == 'e' || s[i] == 'E'){ cnt3++; if(i == r || i == l){ flag = 0; break; } if(numb(s[i-1]) == 0 || (!(numb(s[i+1]) == 1 || s[i+1] == '+' || s[i+1] == '-'))){ flag = 0; break; } } else if(!numb(s[i])){ flag = 0; break; } i++; } if(cnt1 > 1 || cnt2 > 1 || cnt3 > 1) flag = 0; if(flag && (cnt1 || cnt3)) printf("YES\n"); else printf("NO\n"); return 0; }