Advertisement
dungpt

Untitled

Jul 23rd, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.18 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #define FOR(i, x, a)  for(long i=x; i<=a; i++)
  3. #define FORD(i, x, a) for(long i=x; i>=a; i--)
  4. #define ll long long
  5. #define pii pair < int, int >
  6. #define vii vector < pii >
  7. #define ms(a, x) memset(a, x, sizeof(a))
  8. #define NMAX 1001
  9.  
  10. using namespace std;
  11. int t;
  12. string s;
  13. int main() {
  14.     ios_base::sync_with_stdio(false); cin.tie(NULL);
  15.     //freopen("text.inp", "r", stdin);
  16.     cin >> t;
  17.     getline(cin, s);
  18.     long i;
  19.     char u;
  20.     while (t--) {
  21.         getline(cin, s);
  22.         string x = "";
  23.         i = 1;
  24.         while (i < s.size() && s[i] != ' ') x += s[i], i++;
  25.         if (x.size()) {
  26.             cout << char(x[0] - 32);
  27.             FOR(j, 1, x.size() - 1) cout << x[j];
  28.             cout << char(s[0] + 32);
  29.         }
  30.         else cout << s[0];
  31.         cout << "ay ";
  32.         i++;
  33.         while (i < s.size()) {
  34.             u = s[i];
  35.             i++;
  36.             if (i == s.size()) {
  37.                 cout << u << "ay ";
  38.                 break;
  39.             }
  40.             while (i < s.size() && s[i] != ' ') cout << s[i], i++;
  41.             cout << u << "ay ";
  42.             i++;
  43.         }
  44.         cout << endl;
  45.     }
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement