Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma comment(linker, "/STACK:268435456")
  2. #include <iostream>
  3. #include <sstream>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <string>
  7. #include <algorithm>
  8. #include <vector>
  9. #include <math.h>
  10. #include <set>
  11. #include <map>
  12. #include <queue>
  13. #include <iomanip>
  14. #include <assert.h>
  15. #include <stack>
  16. #include <deque>
  17. #include <limits.h>
  18. #include <memory.h>
  19. #include <ctime>
  20. //#include <unordered_map>
  21. //#include <unordered_set>
  22. using namespace std;
  23.  
  24. void prepare(string q) {
  25. #ifdef _DEBUG
  26.         //system("color F0");
  27.         freopen("input.txt","r",stdin);
  28.         //freopen("output.txt","w",stdout);
  29. #else
  30.         if (q.size()!=0)
  31.         {
  32.                 freopen((q+".in").c_str(),"r",stdin);
  33.                 freopen((q+".out").c_str(),"w",stdout);
  34.         }
  35. #endif
  36.         cin.sync_with_stdio(false);
  37.         cout.sync_with_stdio(false);
  38.         cin.tie(false);
  39. }
  40.  
  41. const int SZ = 50;
  42.  
  43. #define ppb push_back
  44. #define sz(a) (int)a.size()
  45. #define mp make_pair
  46. #define all(a) a.begin(), a.end()
  47.  
  48. void solve()
  49. {
  50.         string s;
  51.         cin>>s;
  52.         vector <bool> v(255,false);
  53.         vector <bool> c(255,false);
  54.         v['A']=true;
  55.         v['E']=true;
  56.         v['I']=true;
  57.         v['O']=true;
  58.         v['U']=true;
  59.         bool nice=false, ugly=false,ugly1=false;
  60.         bool ki=false;
  61.         int gl=0,sgl=0;
  62.         //UGLY
  63.         //gl
  64.         for (int i=0; i<s.size(); ++i)
  65.         {
  66.  
  67.                 if (s[i]=='?')
  68.                 {
  69.                         ++gl;
  70.                         continue;
  71.                 }
  72.                 if (v[s[i]]) ++gl;
  73.                 else gl=0;
  74.                 if (gl>=3)
  75.                         ugly=true;
  76.         }
  77.         //sgl
  78.         for (int i=0; i<s.size(); ++i)
  79.         {
  80.                 if (s[i]=='?')
  81.                 {
  82.                         ++sgl;
  83.                         continue;
  84.                 }
  85.                 if (!v[s[i]]) ++sgl;
  86.                 else sgl=0;
  87.                 if (sgl>=5)
  88.                         ugly=true;
  89.         }
  90.         //nothing
  91.         gl=sgl=0;
  92.         for (int i=0; i<s.size(); ++i)
  93.         {
  94.                 if (s[i]=='?')
  95.                 {
  96.                         continue;
  97.                 }
  98.                 if (!v[s[i]])
  99.                 {
  100.                         gl=0;
  101.                         ++sgl;
  102.                 }
  103.                 else
  104.                 {
  105.                         sgl=0;
  106.                         ++gl;
  107.                 }
  108.                 if (gl>=3 || sgl>=5)
  109.                         ugly1=true;
  110.         }
  111.  
  112.         //NICE
  113.         sgl=gl=0;
  114.         for (int i=0; i<s.size(); ++i)
  115.         {
  116.             if (s[i]=='?')
  117.             {
  118.                 if (gl==2)
  119.                 {
  120.                     sgl=1;
  121.                     gl=0;
  122.                     continue;
  123.                 }
  124.                 if (sgl==4)
  125.                 {
  126.                     gl=1;
  127.                     sgl=0;
  128.                     continue;
  129.                 }
  130.                 int g=0,c=0;
  131.                 for (int j=i+1; j<s.size(); ++j)
  132.                 {
  133.                     if (s[i]=='?') break;
  134.                     if (v[s[i]]) ++g;
  135.                     else break;
  136.                 }
  137.                 for (int j=i+1; j<s.size(); ++j)
  138.                 {
  139.                     if (s[i]=='?') break;
  140.                     if (!v[s[i]]) ++c;
  141.                     else break;
  142.                 }
  143.  
  144.             }
  145.             if (v[s[i]])
  146.             {
  147.                 ++gl;
  148.                 sgl=0;
  149.             }
  150.             else
  151.             {
  152.                 ++sgl;
  153.                 gl=0;
  154.             }
  155.         }
  156.  
  157.  
  158. }
  159.  
  160. int main()
  161. {
  162.         prepare("");
  163.         solve();
  164.         return 0;
  165. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement