TCHS SRM 56 250 pt - Strange Comparator editorial: http://community.topcoder.com/tc?module=Static&d1=hs&d2=match_editorials&d3=hs_srm56
TCHS SRM 56 250 pt - Strange Comparator solution:
#include <iostream> #include <vector> class StrangeComparator { public: std::vector <std::string> compareString(std::vector <std::string> a, std::vector <std::string> b) { int cnt=0, f=0; std::vector <std::string> v; for(int i=0; i<a.size(); i++, cnt=0, f=0) { if(a[i].length()!=b[i].length()) f=1; if(f==0) for(int j=0; j<a[i].length(); j++) if(a[i][j]!=b[i][j]) cnt++; if(cnt>1 || f==1) v.push_back("No"); else v.push_back("Yes"); } return v; } };