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 <stdio.h>
#include <string.h>

int gcd(int a,int b){
	return b ? gcd(b,a%b) : a;
}

int change(char str[257],int a,int b){
	int i;
	for(i = 0;str[i] != '\0';i++){
		str[i] = str[i] == ' ' ? ' ' : (a*(str[i]-'a')+b)%26+'a';
	}
	for(i = 0;str[i+3] != '\0';i++){
		if(!strncmp(str+i,"that",4) || !strncmp(str+i,"this",4)){
			return 1;
		}
	}
	
	return 0;
}

int main(void) {
	int i,n,a,b;
	char str[257],str2[257];
	
	scanf("%d",&n);
	gets(str);
	for(i = 0;i < n;i++){
		gets(str);
		for(a = 1;a < 26;a+=2){
			for(b = 1;b < 26;b++){
				if(gcd(a,26) != 1) continue;
				strcpy(str2,str);
				if(change(str2,a,b)){
					goto end;
				}
			}
		}
end:
		printf("%s\n",str2);
	}
	
	return 0;
}

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

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

int main()
{
	string str;
	char str1[8]="that",src1[8]="that";
	char str2[8]="this",src2[8]="this";

	int a,b,n; cin >> n; cin.ignore();
	while(n--)
	{
		getline(cin,str);

		for(a=1; true; a++)
		{
			if(a%2==0 || a%13==0) continue;

			for(b=0; b<26; b++)
			{
				for(int i=0; i<4; i++)
				{
					str1[i] = F(src1[i],a,b);
					str2[i] = F(src2[i],a,b);
				}
				if(str.find(str1)!=string::npos
				|| str.find(str2)!=string::npos)
				{
					goto ex;
				}
			}
		}

		ex:;

		char tb[256];
		for(char i='a'; i<='z'; i++)
		{
			tb[F(i,a,b)] = i;
		}
		tb[' ']=' ';

		for(int i=0; i<str.size(); i++)
		{
			cout << tb[str[i]];
		}
		cout << endl;
	}
}

C++: #include <iostream>
#include <stdio.h>
#include <math.h>

using namespace std;

int alpha,beta;

char function(char c){

	//文字を数字に変える。
	int num = c-'a';

	int tmp = (alpha*num+beta)%26;

	char ans = (char)tmp + 'a';

	return ans;


}

int main(){
	alpha = 3;
	beta = 2;

	int n;
	cin>>n;
	cin.ignore();

	for(int i=0;i<n;i++){
		string str;
		
		getline(cin,str);

		char tmp[260];
		int breakFlag=0;
		for(alpha = 0;alpha<1000;alpha++){
			for(beta = 0;beta<26;beta++){
				for(int j=0;j<str.size();j++){
					if(str[j]==' '){
						tmp[j] = ' ';
					}
					else{
						tmp[j] = function(str[j]);
					}
				}
				/*
				for(int j=0;j<str.size();j++){
					cout<<tmp[j];
				}
				cout<<endl;
				*/
				for(int j=0;j<str.size()-3;j++){
					if(tmp[j]=='t'&&tmp[j+1]=='h'&&tmp[j+2]=='i'&&tmp[j+3]=='s'){
						breakFlag=1;
						break;
					}
					if(tmp[j]=='t'&&tmp[j+1]=='h'&&tmp[j+2]=='a'&&tmp[j+3]=='t'){
						breakFlag=1;
						break;
					}
				}
				if(breakFlag==1){
					break;
				}
			}
			if(breakFlag == 1){
				break;
			}
		}
		for(int j=0;j<str.size();j++){
			cout<<tmp[j];
		}
		cout<<endl;
	}

	return 0;


}

/*
Sample Input
1
y eazqyp pnop pngtg ye obmpngt xmybp mr lygw
Output for the Sample Input
i submit that there is another point of view
*/

C++: #include<stdio.h>
#include<string.h>
char c[257];
char d[257];
bool use[26];
int main(){
	int a;
	scanf("%d ",&a);
	while(a--){
		gets(c);
		int t=strlen(c);
		for(int i=0;i<26;i++){
			for(int j=0;j<26;j++){
				bool ok=false;
				for(int k=0;k<26;k++)use[k]=false;
				for(int k=0;k<26;k++){
					if(use[(i*k+j)%26])goto dame;
					else use[(i*k+j)%26]=true;
				}
				for(int k=0;k<t;k++){
					if(c[k]<='z'&&c[k]>='a'){
						d[k]=(i*(c[k]-'a')+j)%26+'a';
					}else{
						d[k]=c[k];
					}
				}
				for(int k=0;k<t-3;k++){
					if(d[k]=='t'&&d[k+1]=='h'){
						if(d[k+2]=='a'&&d[k+3]=='t')ok=true;
						if(d[k+2]=='i'&&d[k+3]=='s')ok=true;
					}
				}
				if(ok){
					printf("%s\n",d);
				}
				dame:;
			}
		}
	}
}

C++: #include<iostream>
#include<string>
#include<ctype.h>
using namespace std;
int main(){
 string s;
 int n;
 cin>>n;
 for(int u=0;u<n;u++){
 getline(cin,s);
 int a=0;
 bool t=false;
 while(true){
  int b=0;
  while(true){
      for(int i=0;i<s.size();i++){
       if(isalpha(s[i])!=0)
        s[i]=(a*(s[i]-'a')+b)%26+'a';   
      }
      for(int i=0;i<s.size()-3;i++){
       if(s[i]=='t'&&s[i+1]=='h'&&s[i+2]=='i'&&s[i+3]=='s'){
       t=true;
       break;
       }
       if(s[i]=='t'&&s[i+1]=='h'&&s[i+2]=='a'&&s[i+3]=='t'){
       t=true;
       break;
       }
      }
      b++;
  }
  if(t==true)
  break;
  a++;
 }
 for(int i=0;i<s.size();i++)
 cout<<s[i];
 cout<<endl;
 }
 return 0;   
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <istream>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <climits>
using namespace std;

typedef ostringstream OSS;
typedef istringstream ISS;

typedef vector<int> VI;
typedef vector< VI > VVI;

typedef long long LL;

typedef pair<int, int> PII;
typedef vector<PII> VPII;

#define X first
#define Y second

map<char, char> computeMap(int a, int b) {
	map<char, char> res;
	for (int x = 0; x < 26; x++) {
		int y = (a * x + b) % 26;
		res[y + 'a'] = x + 'a';
	}

	return res;
}

string decode(string str, map<char, char> m) {
	for (auto &c : str) {
		c = isalpha(c) ? m[c] : c;
	}
	return str;
}

string solve(string str) {
	for (int a = 0; a < 26; a++) {
		for (int b = 0; b < 26; b++) {
			if (__gcd(a, 26) != 1) continue;
			map<char, char> m = computeMap(a, b);
			string decoded = decode(str, m);
			if (decoded.find("that") != string::npos || 
				decoded.find("this") != string::npos) {
				return decoded;
			}
		}
	}
	return "hoge";
}

int main(void) {
	int N;
	cin >> N;
	cin.get();

	for (int i = 0; i < N; i++) {
		string str;
		getline(cin, str);
		cout << solve(str) << endl;
	}

	return 0;
}