#include<cassert>
#include<string>
using namespace std;

class CCipher {
public:
  string decode(string cipherText, int shift) {
    string orig;
    for (char c : cipherText) {
      orig += 'A' + (c - 'A' - shift + 26) % 26 ;
    }
    return orig;
  }
};

int main() {
  CCipher cc;
  assert(cc.decode("ABCDEFGHIJKLMNOPQRSTUVWXYZ", 10) == "QRSTUVWXYZABCDEFGHIJKLMNOP");
}

#include<string>
using namespace std;

class CCipher {
public:
	string decode(string cipherText, int shift) {
		string orig;
		for (char c : cipherText) {
			orig += 'A' + (c - 'A' - shift) % 26 ;
			//orig.append();
		}
		return orig;
	}
};

--- 
+++ 
@@ -1,14 +1,19 @@
+#include<cassert>
 #include<string>
 using namespace std;
 
 class CCipher {
 public:
-	string decode(string cipherText, int shift) {
-		string orig;
-		for (char c : cipherText) {
-			orig += 'A' + (c - 'A' - shift) % 26 ;
-			//orig.append();
-		}
-		return orig;
-	}
+  string decode(string cipherText, int shift) {
+    string orig;
+    for (char c : cipherText) {
+      orig += 'A' + (c - 'A' - shift + 26) % 26 ;
+    }
+    return orig;
+  }
 };
+
+int main() {
+  CCipher cc;
+  assert(cc.decode("ABCDEFGHIJKLMNOPQRSTUVWXYZ", 10) == "QRSTUVWXYZABCDEFGHIJKLMNOP");
+}
Fix SRM 147, Div 2, Problem CCipher

- previously without system test checks
- plus length of alphabet, in case of negative shifted index
