Sreekar_0125

Untitled

Feb 4th, 2022
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int t;
  7.     cin>>t;
  8.     while(t--) {
  9.         string s;
  10.         int n,k;
  11.         int count=0;
  12.         cin>>n>>k;
  13.         cin>>s;
  14.        
  15.        
  16.         for(int i=0;i<(n/2);i++) {
  17.             if(s[i]!=s[n-i-1]) {
  18.                 s[i]=s[n-i-1];
  19.                 count++;
  20.             }
  21.            
  22.         }
  23.        
  24.        
  25.       if(count=k) {
  26.           cout<<"Yes"<<endl;
  27.       }
  28.       else {
  29.           cout<<"No"<<endl;
  30.       }
  31.        
  32.     }
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment