Solution for DMOPC '19 Contest 4 P0 - Yikes in C++


May 12, 2020 0.247626 seconds C++
#include <bits/stdc++.h>
using namespace std;
string a, b;
int c;

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> a >> b;
	for(int i = 0; i < a.length(); i++){
		if(a[i] != b[i]){
			c++;
			if(c == 2) break;
		}
	}

	if(c == 1){
	    printf("LARRY IS SAVED!");
	}else{
		printf("LARRY IS DEAD!");
	}

	return 0;
}

Editorial


No editorial for this problem. :(

Original Problem


You can view the original page for this problem on the DMOJ.