Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm. It took him only a minute to figure out that those strange strings are actually referring to the coded time Thursday 14:04 -- since the first common capital English letter (case sensitive) shared by the first two strings is the 4th capital letter D, representing the 4th day in a week; the second common character is the 5th capital letter E, representing the 14th hour (hence the hours from 0 to 23 in a day are represented by the numbers from 0 to 9 and the capital letters from A to N, respectively); and the English letter shared by the last two strings is s at the 4th position, representing the 4th minute. Now given two pairs of strings, you are supposed to help Sherlock decode the dating time.

Input Specification:

Each input file contains one test case. Each case gives 4 non-empty strings of no more than 60 characters without white space in 4 lines.

Output Specification:

For each test case, print the decoded time in one line, in the format DAY HH:MM, where DAY is a 3-character abbreviation for the days in a week -- that is, MON for Monday, TUE for Tuesday, WED for Wednesday, THU for Thursday, FRI for Friday, SAT for Saturday, and SUN for Sunday. It is guaranteed that the result is unique for each case.

Sample Input:

3485djDkxh4hhGE
2984akDfkkkkggEdsb
s&hgsfdk
d&Hyscvnm

Sample Output:

THU 14:04
 #include <iostream>
#include <string>
using namespace std;
int main()
{
string date[] = { "MON","TUE","WED","THU","FRI","SAT","SUN" };
string s1, s2, s3, s4;
cin >> s1 >> s2 >> s3 >> s4;
int flag = ;
for (int i = ; i < s1.length() && i<s2.length(); ++i)
{
if (flag == && s1[i] >= 'A' && s1[i] <= 'Z' && s1[i] == s2[i])
{
cout << date[s1[i] - 'A'] << " ";
flag = ;
}
else if(flag == && s1[i] == s2[i] && ((s1[i] >= 'A' && s1[i] <= 'Z') || (s1[i] >= '' && s1[i] <= '')))
{
if (s1[i] >= ''&& s1[i] <= '')
cout << "" << s1[i] - '' << ":";
else
cout << (s1[i] - 'A' + ) << ":";
break;
}
}
int k = ;
for (int i = ; i < s3.length() && i < s4.length(); ++i)
{
if (((s3[i] >= 'a' && s3[i] <= 'z') || (s3[i] >= 'A' && s3[i] <= 'Z')) && s3[i] == s4[i])
{
k = i;
break;
}
}
cout << (k > ? "" : "") << k << endl;
return ;
}

PAT甲级——A1061 Dating的更多相关文章

  1. PAT 甲级 1061 Dating (20 分)(位置也要相同,题目看不懂)

    1061 Dating (20 分)   Sherlock Holmes received a note with some strange strings: Let's date! 3485djDk ...

  2. PAT甲级——1061 Dating (20分)

    Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2984akDfkkkkg ...

  3. PAT甲级——1061 Dating

    1061 Dating Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2 ...

  4. PAT甲级1061 Dating

    题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805411985604608 题意: 给定四个字符串. 前两个字符串 ...

  5. PAT甲级题解(慢慢刷中)

    博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6102219.html特别不喜欢那些随便转载别人的原创文章又不给 ...

  6. PAT甲级题分类汇编——线性

    本文为PAT甲级分类汇编系列文章. 线性类,指线性时间复杂度可以完成的题.在1051到1100中,有7道: 题号 标题 分数 大意 时间 1054 The Dominant Color 20 寻找出现 ...

  7. PAT甲级题分类汇编——序言

    今天开个坑,分类整理PAT甲级题目(https://pintia.cn/problem-sets/994805342720868352/problems/type/7)中1051~1100部分.语言是 ...

  8. PAT甲级代码仓库

    大道至简,知易行难.希望能够坚持刷题. PAT甲级真题题库,附上我的代码. Label Title Score Code Level 1001 A+B Format 20 1001 * 1002 A+ ...

  9. PAT甲级1131. Subway Map

    PAT甲级1131. Subway Map 题意: 在大城市,地铁系统对访客总是看起来很复杂.给你一些感觉,下图显示了北京地铁的地图.现在你应该帮助人们掌握你的电脑技能!鉴于您的用户的起始位置,您的任 ...

随机推荐

  1. Spring的refresh()方法相关异常

    如果是经常使用Spring,特别有自己新建ApplicationContext对象的经历的人,肯定见过这么几条异常消息:1.LifecycleProcessor not initialized - c ...

  2. Spring MVC(十六)--Spring MVC国际化实例

    上一篇文章总结了一下Spring MVC中实现国际化所需的配置,本文继上一文举一个完整的例子,我选择用XML的方式.我的场景是这样的: 访问一个页面时,这个页面有个表格,对表头中的列名实现国际化. 第 ...

  3. wpf 纯样式写按钮

    <!--自定义按钮样式--> <LinearGradientBrush x:Key="LinearGradientBlueBackground" EndPoint ...

  4. 全面理解python中self的用法

    self代表类的实例,而非类. class Test: def prt(self): print(self) print(self.__class__) t = Test() t.prt() 执行结果 ...

  5. BZOJ2226:[SPOJ5971]LCMSum

    Description Given n, calculate the sum LCM(1,n) + LCM(2,n) + .. + LCM(n,n), where LCM(i,n) denotes t ...

  6. 使用movable-view制作可拖拽的微信小程序弹出层效果。

    仿了潮汐睡眠小程序的代码.[如果有侵权联系删除 最近做的项目有个弹出层效果,类似音乐播放器那种.按照普通的做了一般感觉交互不是很优雅,设计妹子把潮汐睡眠的弹层给我看了看,感觉做的挺好,于是乘着有空仿照 ...

  7. php数据结构课程---6、常见排序有哪些

    php数据结构课程---6.常见排序有哪些 一.总结 一句话总结: 冒泡排序(Bubble sort):依次交换 选择排序 ( Selection Sort ):在未排序序列中找到最小(大)元素,依次 ...

  8. java使用stream流批量读取并合并文件,避免File相关类导致单文件过大造成的内存溢出。

    import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.F ...

  9. 反编译之paktool工具

    1.官网配置mac教程https://ibotpeaches.github.io/Apktool/install/ (1)右键选择:链接储存为(命名:apktool,格式:选择所有文件): (2)下载 ...

  10. C++写矩阵的转置

    (2019年2月19日注:这篇文章原先发在自己github那边的博客,时间是2017年2月5日) 对于任意非n阶矩阵的转置,用c++应该怎么写代码,思考了一下,发现并没有那么简单,上网找到了一个比较好 ...