Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- void check(string word)
- {
- int len = word.length(), smallorbig = 1; // big
- if(len%2==1)
- {
- for(int i=0;i<len;i++)
- {
- if(i%2==0)
- putchar(toupper(word[i]));
- else putchar(tolower(word[i]));
- }
- }
- else
- {
- for(int i=0;i<len/2;i++)
- {
- if(i%2==0)
- putchar(toupper(word[i]));
- else putchar(tolower(word[i]));
- }
- for(int i=len/2;i<len;i++)
- {
- if(i%2==1)
- putchar(toupper(word[i]));
- else putchar(tolower(word[i]));
- }
- }
- }
- void single(string str)
- {
- string word = "";
- for (auto x : str)
- {
- if (x == ' ')
- {
- check(word);
- cout << " ";
- word = "";
- }
- else
- word = word + x;
- }
- check(word);
- }
- int main()
- {
- int t; cin >> t; getchar();
- while(t--)
- {
- string str;
- getline(cin, str);
- single(str);
- cout << '\n';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement