Open Mahagowri opened 8 months ago
Team Name: ABC File Name: c/c++ 4 Line Number: [12, 13, 14, 15, 16, 17, 18, 19, 20, 21] Bug Description: character Solution: //program to emulate the caesar cipher, a simple encryption technique that involves shifting the letters of the alphabet, k positions to the right (or left). //consider all characters to be lower case only // eg: s = "abc", k = 2, direction = "encode" => "cde"
using namespace std;
string caesar(string s, int k, string direction){ string ans = ""; for(int i=0;i<s.length();i++){ if(isalpha(s[i])){ if(direction == "encode"){ ans += char(s[i] + k); } else if(direction == "decode"){ ans += char(s[i] - k); } } else{ ans += s[i]; } } return ans; }
int main(){ string s, direction; int k; cin >> s >> k >> direction; cout<<caesar(s,k,direction)<<endl; return 0; }
Bug Hunt Evaluation: Answer: ((13,),) Correctness: 0/1 Points: 0/100
b'\x0c,Y\xa4\xe1\x14\xd9\xd9\x1d!\xc7\xe4I\xa9\xb3\xbf0dV\x95\x11H\xf8\x1cr\xb2[3$n\x01\xc3\xdd\xac\xc7\xf5\x01W\'\xf1\xd1\xba\xc6\x0c\xad!\xa7\xd8\xa9~\xdd~\xf3\x94\x9f\xec\xdf\xc6\xd5u}\xc2\x98\xd6\xc6rXr\x94/n\x1eiQ"^\xc1\xd9\xe5>9\xb4\x8a#\xa3\xb9\xe1\x85\x83\x04\xc7.\xcf\r\xef\xd5\xb8\xf5Y\xf8K\x81\xe3\xfd\xa15\xddPa\xba\x0e\x9d\x81\x11\xbd\x94\xeap\xeb\x0e\x105\x02]4\x16\xb0\x10'
b'gAAAAABl9TkoXny6jtSB8A78iqDPzEkwGGgkI5E0sjkydLux3eZyGwith-4e9pQqW5Bjx1yAAs3b52_QnROi5u5kcdNWU4wWQW1Xzm-RtQ1EHqYN9nFd76jIqsV6S-pEBtxPqsIbP51d1SdOY6oKAEXSz4Nbw6HsACQYn4mb9RoUn47TsDpxn12l_7hoE6TrV_PV97cCCbhR6RgHAODAYS5uOZAw7gm7aHrhh0L1DSI-yaxfVxWeg-QHfSp-XXZMtLx07-jBqJXDfcVzb9xg-z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