/* Tanzila Islam Southeast University mail : tanzilamohita@gmail.com Problem Link: https://algo.codemarshal.org/contests/DRP2015/problems/B */ #include<iostream> #include<cstdio> using namespace std; bool match (string a, string b) { int flag = 0; for (int i=0; i<a.length(); i++) { if (a[i] != b[i]) { flag++; if (flag >1) return false; } } return true; } int main (void) { int t; //scanf("%d", &t) cin >> t; for (int i=1; i<=t; i++) { int n; scanf("%d", &n); //cin >> n; string array[n]; for (int j=0; j<n; j++) { cin>>array[j]; } string key; cin >> key; printf("Case %d:\n", i); for (int j=0; j<n; j++) { //cout << array[j] << endl; bool result = match (key, array[j]); if (result) cout << array[j] <<endl; } } }
Monday, 2 November 2015
B. Search the Khoj_Solution
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment