Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- char x;
- int q = 1;
- while (cin >> x && q != 6)
- {
- switch (q)
- {
- case 1:
- if (x >= 'A' && x <= 'Z')
- q = 2;
- else
- q = 6;
- break;
- case 2:
- if (x >= 'a' && x <= 'z')
- q = 3;
- else
- q = 6;
- break;
- case 3:
- if (x >= 'a' && x <= 'z')
- q = 4;
- else if (x >= 'A' && x <= 'Z')
- q = 2;
- else
- q = 6;
- break;
- case 4:
- if (x >= 'a' && x <= 'z')
- q = 5;
- else if (x >= 'A' && x <= 'Z')
- q = 2;
- else
- q = 6;
- break;
- case 5:
- if (x >= 'A' && x <= 'Z')
- q = 2;
- else
- q = 6;
- break;
- }
- }
- if (q == 1 || q == 2 || q == 6) cout << "No";
- else cout << "Yes";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement