Submission #4532154


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;

string s;

string solve();

int main() {
  cin >> s;

  cout << solve() << endl;
  return 0;
}

string solve() {
  string ans;
  int n = s.size();
  reverse(s.begin(), s.end());
  for(int i = 0; i < n; ++i) {
    if(i < n - 1 && s[i] == 'A' && s[i + 1] == 'W') {
      ans += 'C';
      s[i + 1] = 'A';
    }
    else
      ans += s[i];
  }
  reverse(ans.begin(), ans.end());
  return ans;
}

Submission Info

Submission Time
Task A - WAsedAC
User m_tsubasa
Language C++14 (GCC 5.4.1)
Score 100
Code Size 466 Byte
Status
Exec Time 6 ms
Memory 640 KB

Test Cases

Set Name Score / Max Score Test Cases
All 100 / 100 0-sample1, 0-sample2, 1-random-AW-small0, 1-random-AW-small1, 1-random-AW-small2, 1-random-AW-small3, 1-random-AW-small4, 1-random-AWC-small0, 1-random-AWC-small1, 1-random-AWC-small2, 1-random-AWC-small3, 1-random-AWC-small4, 2-random-AW-large0, 2-random-AW-large1, 2-random-AW-large2, 2-random-AW-large3, 2-random-AW-large4, 2-random-AWC-large0, 2-random-AWC-large1, 2-random-AWC-large2, 2-random-AWC-large3, 2-random-AWC-large4, 3-WWWA-large-0, 3-WWWA-large-1, 3-WWWA-large-2, 3-WWWA-large-3, 3-WWWA-large-4, 3-WWWA-large-5, 3-WWWA-large-6, 3-WWWA-large-7, 3-WWWA-large-8, 3-WWWA-large-9, 9-onecharacter-A, 9-onecharacter-W
Case Name Status Exec Time Memory
0-sample1 1 ms 256 KB
0-sample2 1 ms 256 KB
1-random-AW-small0 1 ms 256 KB
1-random-AW-small1 1 ms 256 KB
1-random-AW-small2 1 ms 256 KB
1-random-AW-small3 1 ms 256 KB
1-random-AW-small4 1 ms 256 KB
1-random-AWC-small0 1 ms 256 KB
1-random-AWC-small1 1 ms 256 KB
1-random-AWC-small2 1 ms 256 KB
1-random-AWC-small3 1 ms 256 KB
1-random-AWC-small4 1 ms 256 KB
2-random-AW-large0 4 ms 512 KB
2-random-AW-large1 3 ms 384 KB
2-random-AW-large2 4 ms 512 KB
2-random-AW-large3 6 ms 640 KB
2-random-AW-large4 2 ms 384 KB
2-random-AWC-large0 1 ms 256 KB
2-random-AWC-large1 4 ms 512 KB
2-random-AWC-large2 4 ms 640 KB
2-random-AWC-large3 4 ms 512 KB
2-random-AWC-large4 2 ms 256 KB
3-WWWA-large-0 5 ms 640 KB
3-WWWA-large-1 3 ms 384 KB
3-WWWA-large-2 3 ms 384 KB
3-WWWA-large-3 4 ms 512 KB
3-WWWA-large-4 3 ms 512 KB
3-WWWA-large-5 5 ms 640 KB
3-WWWA-large-6 4 ms 512 KB
3-WWWA-large-7 3 ms 384 KB
3-WWWA-large-8 5 ms 640 KB
3-WWWA-large-9 5 ms 640 KB
9-onecharacter-A 1 ms 256 KB
9-onecharacter-W 1 ms 256 KB