description: A string is called square if it is some string written twice in a row. For example, the strings "aa", "abcabc", "abab" and "baabaa" are square. But the strings "aaa", "abaaab" and "abcdabc" are not square.
  
  For a given string s determine if it is square.
  
  Input
  
  The first line of input data contains an integer t (1 ≤ t ≤ 100) —the number of test cases.
  
  This is followed by t lines, each containing a description of one test case. The given strings consist only of lowercase Latin letters and have lengths between 1 and 100 inclusive.
  
  Output
  
  For each test case, output on a separate line:
  
    * YES if the string in the corresponding test case is square, 
    * NO otherwise. 
  
  
  
  You can output YES and NO in any case (for example, strings yEs, yes, Yes and YES will be recognized as a positive response).
  
  Example
  
  Input
  
  
  10
  a
  aa
  aaa
  aaaa
  abab
  abcabc
  abacaba
  xxyy
  xyyx
  xyxy
  
  
  Output
  
  
  NO
  YES
  NO
  YES
  YES
  YES
  NO
  NO
  NO
  YES
solution: import java.io.*;
  import java.util.*;
  
  public class SquareString {
  
  	public static void main(String[] args) {
  		int tc = ni();
  		StringBuilder out = new StringBuilder();
  		for (; tc > 0; tc--) {
  			String str = ns();
  			if (str.length() % 2 == 0) {
  				boolean flag = true;
  				int j = str.length() / 2;
  				for (int i = 0; i < str.length() / 2; i++) {
  					for (; j < str.length();) {
  						if (str.charAt(i) != str.charAt(j)) {
  							out.append("NO").append("\n");
  							flag = false;
  							break;
  						}
  						j++;
  						break;
  					}
  					if (!flag) {
  						break;
  					}
  				}
  				if (flag) {
  					out.append("YES").append("\n");
  				}
  
  			} else {
  				out.append("NO").append("\n");
  			}
  		}
  		System.out.println(out);
  
  	}
  
  	static InputStream is = System.in;
  	static byte[] inbuf = new byte[1 << 24];
  	static int lenbuf = 0, ptrbuf = 0;
  
  	static int readByte() {
  		if (lenbuf == -1)
  			throw new InputMismatchException();
  		if (ptrbuf >= lenbuf) {
  			ptrbuf = 0;
  			try {
  				lenbuf = is.read(inbuf);
  			} catch (IOException e) {
  				throw new InputMismatchException();
  			}
  			if (lenbuf <= 0)
  				return -1;
  		}
  		return inbuf[ptrbuf++];
  	}
  
  	static boolean isSpaceChar(int c) {
  		return !(c >= 33 && c <= 126);
  	}
  
  	static int skip() {
  		int b;
  		while ((b = readByte()) != -1 && isSpaceChar(b))
  			;
  		return b;
  	}
  
  	static double nd() {
  		return Double.parseDouble(ns());
  	}
  
  	static char nc() {
  		return (char) skip();
  	}
  
  	static String ns() {
  		int b = skip();
  		StringBuilder sb = new StringBuilder();
  		while (!(isSpaceChar(b))) {
  			sb.appendCodePoint(b);
  			b = readByte();
  		}
  		return sb.toString();
  	}
  
  	static char[] ns(int n) {
  		char[] buf = new char[n];
  		int b = skip(), p = 0;
  		while (p < n && !(isSpaceChar(b))) {
  			buf[p++] = (char) b;
  			b = readByte();
  		}
  		return n == p ? buf : Arrays.copyOf(buf, p);
  	}
  
  	static int ni() {
  		int num = 0, b;
  		boolean minus = false;
  		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
  			;
  		if (b == '-') {
  			minus = true;
  			b = readByte();
  		}
  		while (true) {
  			if (b >= '0' && b <= '9') {
  				num = num * 10 + (b - '0');
  			} else {
  				return minus ? -num : num;
  			}
  			b = readByte();
  		}
  	}
  
  	static long nl() {
  		long num = 0;
  		int b;
  		boolean minus = false;
  		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
  			;
  		if (b == '-') {
  			minus = true;
  			b = readByte();
  		}
  		while (true) {
  			if (b >= '0' && b <= '9') {
  				num = num * 10 + (b - '0');
  			} else {
  				return minus ? -num : num;
  			}
  			b = readByte();
  		}
  	}
  }
  