Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #include <cstdio>
  2. #include <cstring>
  3. using namespace std;
  4. int a, i, j, nr, p, w[105];
  5. char s[105];
  6. int main()
  7. {
  8.     gets(s + 1);
  9.     a = strlen(s + 1);
  10.     for(i = 1; i <= a; i ++)
  11.     {
  12.         if(s[i] == '.')
  13.             {
  14.             for(j = i + 1; j <= a; j ++)
  15.             if(s[j]!='0' && s[j]!='1' && s[j]!='2' && s[j]!='3' && s[j]!='4' && s[j]!='5' && s[j]!='6' && s[j]!='7' && s[j]!='8' && s[j]!='9') {p=j-1;break;}
  16.             if(p == 0) p = a;
  17.             for(j = i - nr; j <= p; j ++)
  18.             w[j] = true;
  19.             }
  20.             if(s[i] <= '9' && s[i] >= '0') nr ++;
  21.             else nr = 0;
  22.             p = 0;
  23.     }
  24.     for(i = 1; i <= a; i ++)
  25.         if(!w[i]) printf("%c", s[i]);
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement