A. Inna and Choose Options
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

There always is something to choose from! And now, instead of "Noughts and Crosses", Inna choose a very unusual upgrade of this game. The rules of the game are given below:

There is one person playing the game. Before the beginning of the game he puts 12 cards in a row on the table. Each card contains a character: "X" or "O". Then the player chooses two positive integers a and b (a·b = 12), after that he makes a table of size a × b from the cards he put on the table as follows: the first b cards form the first row of the table, the second b cards form the second row of the table and so on, the last b cards form the last (number a) row of the table. The player wins if some column of the table contain characters "X" on all cards. Otherwise, the player loses.

Inna has already put 12 cards on the table in a row. But unfortunately, she doesn't know what numbers a and b to choose. Help her win the game: print to her all the possible ways of numbers a, b that she can choose and win.

Input

The first line of the input contains integer t (1 ≤ t ≤ 100). This value shows the number of sets of test data in the input. Next follows the description of each of the t tests on a separate line.

The description of each test is a string consisting of 12 characters, each character is either "X", or "O". The i-th character of the string shows the character that is written on the i-th card from the start.

Output

For each test, print the answer to the test on a single line. The first number in the line must represent the number of distinct ways to choose the pair a, b. Next, print on this line the pairs in the format axb. Print the pairs in the order of increasing first parameter (a). Separate the pairs in the line by whitespaces.

Sample test(s)
Input
4
OXXXOXOOXOOX
OXOXOXOXOXOX
XXXXXXXXXXXX
OOOOOOOOOOOO
Output
3 1x12 2x6 4x3
4 1x12 2x6 3x4 6x2
6 1x12 2x6 3x4 4x3 6x2 12x1
0
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
int main()
{
int t;
cin>>t;
string s;
while(t--)
{
cin>>s;
int ans=;
int flag[];
memset(flag,,sizeof(flag));
for(int i=;i<;i++)
{
if(s[i]=='X')
{
ans++;
flag[]=;
break;
}
}
for(int i=;i<;i++)
{
if(s[i]=='X'&&s[i+]=='X')
{
ans++;
flag[]=;
break;
}
}
for(int i=;i<;i++)
{
if(s[i]=='X'&&s[i+]=='X'&&s[i+]=='X')
{
ans++;
flag[]=;
break;
}
}
for(int i=;i<;i++)
{
if(s[i]=='X'&&s[i+]=='X'&&s[i+]=='X'&&s[i+]=='X')
{
ans++;
flag[]=;
break;
}
}
for(int i=;i<;i++)
{
if(s[i]=='X'&&s[i+]=='X'&&s[i+]=='X'&&s[i+]=='X'&&s[i+]=='X'&&s[i+]=='X')
{
ans++;
flag[]=;
break;
}
}
ans++;
flag[]++;
for(int i=;i<;i++)
{
if(s[i]=='O')
{
ans--;
flag[]--;
break;
}
}
cout<<ans;
//6 1x12 2x6 3x4 4x3 6x2 12x1
if(flag[]==)
cout<<" "<<"1x12";
if(flag[]==)
cout<<" "<<"2x6";
if(flag[]==)
cout<<" "<<"3x4";
if(flag[]==)
cout<<" "<<"4x3";
if(flag[]==)
cout<<" "<<"6x2";
if(flag[]==)
cout<<" "<<"12x1";
cout<<endl;
}
return ;
}

Codeforces Round #234 (Div. 2) A. Inna and Choose Options 模拟题的更多相关文章

  1. Codeforces Round #234 (Div. 2) A. Inna and Choose Options

    A. Inna and Choose Options time limit per test 1 second memory limit per test 256 megabytes input st ...

  2. Codeforces Round #234 (Div. 2) B. Inna and New Matrix of Candies

    B. Inna and New Matrix of Candies time limit per test 1 second memory limit per test 256 megabytes i ...

  3. Codeforces Round #234 (Div. 2) B. Inna and New Matrix of Candies SET的妙用

    B. Inna and New Matrix of Candies time limit per test 1 second memory limit per test 256 megabytes i ...

  4. Codeforces Round #375 (Div. 2) Polycarp at the Radio 优先队列模拟题 + 贪心

    http://codeforces.com/contest/723/problem/C 题目是给出一个序列 a[i]表示第i个歌曲是第a[i]个人演唱,现在选出前m个人,记b[j]表示第j个人演唱歌曲 ...

  5. Codeforces Round #234 (Div. 2) :A. Inna and Choose Options

    A. Inna and Choose Options time limit per test 1 second memory limit per test 256 megabytes input st ...

  6. Codeforces Round #234 (Div. 2)

    A. Inna and Choose Options time limit per test 1 second memory limit per test 256 megabytes input st ...

  7. Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)

    Brain's Photos 题目链接: http://codeforces.com/contest/707/problem/A Description Small, but very brave, ...

  8. Codeforces Round #281 (Div. 2) A. Vasya and Football 模拟

    A. Vasya and Football 题目连接: http://codeforces.com/contest/493/problem/A Description Vasya has starte ...

  9. Codeforces Round #234 (Div. 2):B. Inna and New Matrix of Candies

    B. Inna and New Matrix of Candies time limit per test 1 second memory limit per test 256 megabytes i ...

随机推荐

  1. static, const 和 static const 变量的初始化问题

    const 常量的在超出其作用域的时候会被释放,但是 static 静态变量在其作用域之外并没有释放,只是不能访问. static 修饰的是静态变量,静态函数.对于类来说,静态成员和静态函数是属于整个 ...

  2. 利用github pages五分钟建好个人网站+个人博客

    笔者自己在建个人网站/个人博客的时候其实遇到了不少麻烦,但是都一一解决了,这里教给大家最简单的方式. 首先你需要一个GitHub账号,访问https://github.com创建新账号即可. 然后访问 ...

  3. linux安装python3(已有python2.x情况下)

    参考:https://www.cnblogs.com/Guido-admirers/p/6259410.html 1.官网下载python3 cd /home/download wget https: ...

  4. git —— bug分支

    储藏工作现场 $ git stash 切换到需要修改bug的分支,创建临时分支 修复bug,修复完提交 修复完之后,切换到需要修改的分支.完成合并 合并后删除临时分支 完成后,可以重新回到没有修改完的 ...

  5. Git push将本地版本库的分支推送到远程服务器上对应的分支

    在使用git commit命令将修改从暂存区提交到本地版本库后,只剩下最后一步将本地版本库的分支推送到远程服务器上对应的分支了,如果不清楚版本库的构成,可以查看我的另一篇,git 仓库的基本结构. g ...

  6. Spring整合junit测试

    本节内容: Spring整合junit测试的意义 Spring整合junit测试 一.Spring与整合junit测试的意义 在没整合junit之前,我们在写测试方法时,需要在每个方法中手动创建容器, ...

  7. Chrome-Adobe Flash 无法正常使用

    https://support.google.com/chrome/answer/6258784 该网站因是是google.com,被强了,所以一般打不开. 故将google官方说明记录以下: 如果 ...

  8. mysql千万级表关联优化(2)

    概述: 交代一下背景,这算是一次项目经验吧,属于公司一个已上线平台的功能,这算是离职人员挖下的坑,随着数据越来越多,原本的SQL查询变得越来越慢,用户体验特别差,因此SQL优化任务交到了我手上. 这个 ...

  9. Error_code: 1594(mysql 5617)主从同步报错

    报错信息 2017-09-05 09:37:22 7425 [ERROR] Slave SQL: Relay log read failure: Could not parse relay log e ...

  10. 多线程-TaskExecutor-使用Demo

    BasicExecute.java package com.jef.executeTest; public abstract class BasicExecute extends Thread { @ ...