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, "")
}

Python: import sys
z='abcdefghijklmnopqrstuvwxyz'
e=lambda x,i,j:z[(z.index(x)*i+j)%26]
def f():
 for i in range(1,26,2):
  for j in range(26):
   if''.join(e(c,i,j)for c in'that')in s or''.join(e(c,i,j)for c in'this')in s:return(i,j)
input()
for s in sys.stdin:
 s=s.strip()
 k=f()
 print(s.translate(str.maketrans(''.join(e(c,*k)for c in z),z)))

Python: n = int(input())
s = "abcdefghijklmnopqrstuvwxyz"
for i in range(n):
    inp = input()
    for j in range(26):
        for k in range(26):
            out = ""
            for c_inp in inp:
                if c_inp in s:
                    out += s[(s.index(c_inp)*j+k)%26]
                else:
                    out += c_inp
            if ("that" in out) or ("this" in out):
                print(out)

Python: z='abcdefghijklmnopqrstuvwxyz'
def f(x):
 for i in range(1,26,2):
  for j in range(26):
   a=''.join(z[(z.index(c)*i+j)%26]if c in z else c for c in x)
   if'that'in a or'this'in a:return a
for _ in[0]*int(input()):print(f(input()))

Python: for _ in[0]*int(input()):
 e=input()
 for i in range(1,26,2):
  for j in range(27):
   a=''.join([c,chr(((ord(c)-97)*i+j)%26+97)][c.islower()]for c in e)
   if('that'or'this')in a:print(a);break

Python: def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    return gcd(b, a%b)

def unzip(strlist,a,b):
    ret = []
    for word in strlist:
        tmp = ""
        for i in range(len(word)):
            tmp += chr(((ord(word[i])-97)*a+b)%26+97)
        ret.append(tmp)
    return ret

n = int(input())
for _ in range(n):
    instr = input().split()
    flag = False
    for a in range(1,26):
        if gcd(1,26)!=1 : continue
        if flag: break
        for b in range(26):
            if "this" in unzip(instr, a, b):
                print(" ".join(unzip(instr, a, b)))
                flag = True
                break
            elif "that" in unzip(instr, a, b):
                print(" ".join(unzip(instr, a, b)))
                flag = True
                break

Python: for _ in[0]*int(input()):
 e=input()
 for i in range(26,2):
  for j in range(26):
   a=''.join([c,chr(((ord(c)-97)*i+j)%26+97)][c.islower()]for c in e)
   if('that'or'this')in a:print(a);break

Python: z='abcdefghijklmnopqrstuvwxyz'
e=lambda x,i,j:z[(z.index(x)*i+j)%26]
def f():
 for i in range(1,26,2):
  for j in range(26):
   if''.join(e(c,i,j)for c in'that')in s or''.join(e(c,i,j)for c in'this')in s:return(i,j)
def g(x,y,s=0,t=1):
 q,r=x//y,x%y
 return g(y,r,t,s-q*t) if r else t
for _ in[0]*int(input()):
 s=input()
 a,b=f()
 h=g(26,a)
 print(''.join(z[h*(z.index(c)-b)%26]if c in z else c for c in s))

Python: from itertools import product
n = int(input())
for _ in range(n):
    s = input()
    for alpha,beta in product([3,5,7,9,11,15,17,19,21,23,25],range(26)):
        g = "".join(chr((alpha*(ord(e)-ord("a"))+beta)%26+ord("a")) if not e == " " else " "  for e in s)
        if "that" in g or "this" in g: print(g); break

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

using namespace std;

string affine(string s, int alpha, int beta)
{
	string aff_str;	aff_str.clear();
	for (string::iterator it = s.begin(); it != s.end(); it++) {
		if ( *it == ' ' ) aff_str.push_back(' ');
		else {
			char c = *it - 'a';
			c = (alpha * c + beta) % 26;
			aff_str.push_back(c + 'a');
		}
	}
	return aff_str;
}

int gcd(int x, int y)
{
	if (x==0) return y;
	if (y==0) return x;
	if (y>x)  return gcd(x, y%x);
	return gcd(y, x%y);
}

bool isRelPrime(int x, int y)
{
	return gcd(x, y) == 1;
}

int main()
{
	string buf;
	int n;
	cin >> n;
	
	//char dummy;
	//cin >> dummy; // discard '\n' after the input of n
	
	cin.ignore();
	
	for (int i=0; i<n; i++) {
		buf.clear();
		getline(cin, buf);
		//cout << buf.size() << " " << buf << endl;
		bool success = false;
		for (int alpha = 1; alpha < 26; alpha++) {
			if ( !isRelPrime(alpha, 26) ) continue;
			for (int beta = 0; beta < 26; beta++) {
				string decoded = affine(buf, alpha, beta);
				//cout << decoded << endl;
				if ( (decoded.find("that") != string::npos) || (decoded.find("this") != string::npos) ) {
					cout << decoded << endl; success = true; break;
				}
			}
			if (success) break;
		}
	}
	
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//????????????????????????????????????
#define int long long
#define str string
const int inf = 999999999999999999;
struct P {
	int pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {
	int to, cost;
};
int gcm(int i, int j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
typedef long long ll;
typedef long double ld;
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------
str s;
str solve(int i, int j) {
	str a = "";
	for (int z = 0; z < s.size(); z++) {
		if (s[z] == ' ') a += " ";
		else a += (char)((i*((int)s[z] - 'a') + j) % 26) + 'a';
	}
	for (int z = 0; z < a.size() - 4; z++) {
		str t = "";
		for (int r = 0; r < 4; r++)
			t += a[z + r];
		if (t == "that" || t == "this")
			return a;
	}
	return "shippaidesu";
}
signed main() {
	int n;
	cin >> n;
	getchar();
	for (int i = 0; i < n; i++) {
		getline(cin, s);
		for (int i = 0; i < 26; i++) {
			if (gcm(26, i) > 1&&i!=0)
				continue;
			for (int j = 0; j < 26; j++) {
				if (solve(i, j) != "shippaidesu") {
					cout << solve(i, j) << endl;
					goto stop;
				}
			}
		}
	stop:;
	}
}

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;

	for(int i=0;i<n;i++){
		string str;
		cin.ignore();
		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
*/