Go: package main

import (
	"bufio"
	"os"
	"fmt"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		scanner.Scan()
		s := scanner.Text()
		rs := []rune(s)
		flag := false
		for b := 0; b <= 26; b++ {
			for a := 0; a <= 26; a++ {
				ans := rs
				if a%2 != 0 && a%13 != 0 {
					for j := 0; j < len(ans); j++ {
						if ans[j] > 'a' && ans[j] <= 'z' {
							ans[j] = 'a' + ('a'*(ans[j]-'a')+'b')%26
						}
					}
					sans := runeSlice2String(ans)
					if strings.Contains(sans, "that") || strings.Contains(sans, "this") {
						fmt.Println(sans)
						flag = true
						break
					}
				}
			}
			if flag {
				break
			}
		}
	}
}

func runeSlice2String(input []rune) string {
	tmp := make([]string, len(input))
	for i := 0; i < len(input); i++ {
		tmp[i] = string(input[i])
	}
	return strings.Join(tmp, "")
}

C++: #include <bits/stdc++.h>
using namespace std;

#define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++)
#define ALL(x) x.begin(),x.end()
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

int T,N;
string S;

ll gcd(ll x,ll y)
{
	return y ? gcd(y,x % y) : x;
}

string decode(string s,int a,int b)
{
	FOR(i,0,N) if(s [i] != ' '){
		int d = s [i] - 'a';
		(d += 26 - b) %= 26;
		while(d % a){
			d += 26;
		}
		(d /= a) %= 26;
		s [i] = d + 'a';
	}
	FOR(i,0,N - 3){
		if(s.substr(i,4) == "this" || s.substr(i,4) == "that"){
			return s;
		}
	}
	return "";
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> T;
	cin.ignore();
	FOR(testCase,0,T){
		getline(cin,S);
		N = S.size();
		string ans;
		FOR(i,1,26) if(gcd(26,i) == 1){
			FOR(j,0,26){
				string res = decode(S,i,j);
				if(res.empty() == false){
					ans = res;
					break;
				}
			}
			if(ans.empty() == false) break;
		}
		cout << ans << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
using namespace std;
int main()
{
	int n; 
	string in;
	getline(cin,in);
	n=atoi(in.c_str());
	while(n--)
	{
		getline(cin,in);
		int dig[26];
		string ans="";
		bool flag=false;
		for(int i = 1;;i+=2)
		{
			if(i%13==0) continue;
			for(int j = 0; j < 26; ++j)
			{
				for(int k = 0; k < 26; ++k)
				{
					dig[k]=(i*k+j)%26;
				}
				ans="";	
				for(int k = 0; k < in.size(); ++k)
				{
					if(in[k]==' ') ans+=' ';
					else 
					{
						char tmp='a'+dig[in[k]-'a'];
						ans+=tmp;
					}
				}
				//cout<<ans<<endl;
				if(ans.find("that")!=-1||ans.find("this")!=-1)
				{
					cout<<ans<<endl;
					flag=true;
				}
				if(flag) break;
			}
			if(flag) break;
		}

	}
  return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main(){
  int n;
  string str;
  cin >> n;
  getline(cin,str);
  while(n--){
    str = "";
    getline(cin,str);
    string s = str;
    for(int a = 0 ; a < 100 ; a++ ){
      for(int b = 0 ; b < 26 ; b++){
	string t = "";
	for(int i = 0 ; i < str.size() ; i++){
	  for(int c = 0 ; c < 26 ; c++){
	    if(s[i] - 'a' == (a*c + b)%26){
	      t+=char(c + 'a');
	    }
	  }
	  if(s[i] - 'a' == -65)t+=' ';
	}
	if(t.find("that") != string::npos || t.find("this") != string::npos){
	  cout << t << endl;
	  goto N;
	}
      }
    }
  N:;
  }
}

C++: #include <iostream>
#include <string>

#define N 10000
using namespace std;

main(){
  int n;
  string data[150];
  string tmp[150];
  cin >> n;
  for(int i=0;i<n;i++){
    int size;
    for(size=0;;size++){
      cin >> data[size];
      char c;
      scanf("%c", &c);
      if(c=='\n'){
	break;
      }
    }
    size++;
    for(int i=3;i<N;i+=2){
      if(i%13==0) continue;
      for(int j=0;j<N;j++){
	for(int k=0;k<size;k++){
	  tmp[k]="";
	}
	for(int a=0, b=0;a<size;b++){
	  if(data[a].size()<=b){
	    a++;
	    b=-1;
	    continue;
	  }
	  char c=(char)((i*(int)(data[a][b]-'a')+j)%26);
	  c+='a';
	  tmp[a]+=c;
	}
	for(int k=0;k<size;k++){
	  if(tmp[k]=="that" || tmp[k]=="this"){
	    for(int l=0;l<size;l++){
	      cout << tmp[l];
	      if(l==size-1) cout << endl;
	      else cout << ' ';
	    }
	    return 0;
	  }
	}
      }
    }
  }
  return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;

#define rep(a, b, i) for(int i = a; i < b; i++)

char ch(int a, int b, int c) {
	return (a * (c - 'a') + b) % 26 + 'a';
}

int main() {
	int n, a, b, c;
	cin >> n;
	cin.ignore();

	string str, res = "";
	for (; n > 0; n--) {
		getline(cin, str);

		rep(1, 27, a) {
			if (a == 2 || a == 13) continue;
			rep(1, 20, b) {
				res = str;
				c = 0;
				rep(0, str.size(), c) {
					if (res[c] == ' ') continue;

					res[c] = ch(a, b, res[c]);
				}
				if (res.find("this") != -1 || res.find("that") != -1) {
					cout << res << endl;
					a = 114514;
					b = 114514;
				}
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cstdio>
#include <sstream>
#include <math.h>
#include <boost/math/common_factor.hpp>

using namespace std;

string check(string str);
map<char, int> create_table();

int main(){
  char ch = 'a';
  string str;
  int num;
  vector<string> answers;
  map<char,int> table = create_table();
  cin >> num;

  cin.ignore();
  for(int k=0; k<num; k++){
    getline(cin, str);

    char c;
    char list[1];
    bool flag = true;
    int beta;
    int alpha = 1;
    map<char, int>::iterator itr;
    while(flag){
      if(boost::math::gcd(alpha,26) == 1){ 
        for(beta=1; beta<26; beta++){
          string result;
          for(int i=0; i<str.size(); i++){
            c = str[i];
            if(c != ' '){
              sprintf(list, "%c", ch+(19*table[c]+20)%26);
              result += list[0];
            }else{
              result += ' ';
            }
          }
          if(result.find("this",0) !=string::npos || result.find("that",0) != string::npos){
            answers.push_back(result);
            flag = false;
            break;
          }
        }
      }
      alpha++;
    }
  }

  for(int j=0; j<answers.size(); j++){
    cout << answers[j] << endl;
  }
  return 0;
}


map<char, int> create_table(){
  map<char, int> table;
  char ch[1];
  char str = 'a';

  for(int i=0; i<26; i++){
    sprintf(ch, "%c", str+i); 
    table.insert(pair<char,int>(ch[0],i));
  }
  return table;
}